Hi ! I am working with a huge database and trying top optimize it.
I was wondering if it will make any change to index the values that are used as criteria in the request, but through a function.
For example I have this GPS coordinate table :
-Node (#id,lat,lng)
and this request :
SELECT * FROM Node WHERE distance( lat, lng, $lat, $lng ) < $threshold
Would creating an index on lat and lng make any optimization ? (I'm working with SQLite)
Thanks
Edit I just thought about the same question, but if I make the calculation directly like :
SELECT * FROM Node WHERE (lat-$lat)*(lat-$lat) + (lng-$lng)*(lng-$lng) < $threshold