I'm trying to select data from a Mysql database ordered by the closest (x,y) coordinates to a point ( all 2 dimensional, no oblate spheroids here to complicate stuff ). Problem is that there's a lot of data in there, so selecting and ordering by the length of the hypotenuse from the requested point is going to bring it to it's knees - running functions on a full table scan.
At the moment, I'm taking the top 10 closest as ordered by the sum of the absolute x and y differences, and then re-ordering that list by the length of said hypotenuse to get the 'real' closest one. I'm still using a filesort, but at least no trig functions on the database. Does anyone have a better idea? Although this seems to work ok, it's is a bit rough and ready... Note: mysql and php. It's the best i can do (: Steve -- Steve Holdoway BSc(Hons) MIITP http://www.greengecko.co.nz Linkedin: http://www.linkedin.com/in/steveholdoway Skype: sholdowa _______________________________________________ Linux-users mailing list [email protected] http://lists.canterbury.ac.nz/mailman/listinfo/linux-users
