Comments on: Finding things within some distance in SQL http://www.xaprb.com/blog/2011/01/02/finding-things-within-some-distance-in-sql/ Stay curious! Mon, 13 May 2013 05:55:40 +0000 hourly 1 http://wordpress.org/?v=3.5.1 By: Xaprb http://www.xaprb.com/blog/2011/01/02/finding-things-within-some-distance-in-sql/#comment-19045 Xaprb Tue, 11 Jan 2011 00:51:22 +0000 http://www.xaprb.com/blog/?p=2133#comment-19045 Robert, yes, I agree. I do not completely avoid MyISAM in production. It’s just a nightmare to repair a big table after a crash, for example. But if scenarios like that aren’t a problem, then it’s okay.

]]>
By: Robert http://www.xaprb.com/blog/2011/01/02/finding-things-within-some-distance-in-sql/#comment-19044 Robert Mon, 10 Jan 2011 23:43:08 +0000 http://www.xaprb.com/blog/?p=2133#comment-19044 @Edmar
I’ve developed a method using MyISAM with R-trees as “cache”: http://www.xarg.org/2009/12/people-near-you-with-mysql/

@Baron
I think it’s not the best advice to completely avoid MyISAM tables in production as long as there are features that can not be reproduced by any other SE. You must know what data is business critical (for example user information) and treat it like your eyeball. Anything else which can be obtained within minutes (where I would see such a GEO-cache table) could also rest in a relativeley “insecure” table type.

]]>
By: Edmar http://www.xaprb.com/blog/2011/01/02/finding-things-within-some-distance-in-sql/#comment-19036 Edmar Tue, 04 Jan 2011 23:02:48 +0000 http://www.xaprb.com/blog/?p=2133#comment-19036 Robert, thanks a lot! Agree that measuring query performance is hard, your answer with context is perfect for me. Cheers!

]]>
By: Robert http://www.xaprb.com/blog/2011/01/02/finding-things-within-some-distance-in-sql/#comment-19034 Robert Tue, 04 Jan 2011 17:25:12 +0000 http://www.xaprb.com/blog/?p=2133#comment-19034 @Edmar

1) MySQL

2) Regular B-Tree. It’s hard to give a meaningful description of the performance other than to say the query almost always takes just a few milliseconds, assuming the server isn’t heavily loaded from other queries. Since the app (these are telephone-based speech recognition applications) is presenting a list to the user, it doesn’t make sense to use a radius that will return a huge list, since people are rarely interested in hearing about more than the first 10 or so locations. The majority of the time, they don’t go past the first window of 3 locations. The main exception would be one of our hotel locators when the user is searching in a large city. Even then, the query time is a relatively small fraction of the total time to generate the list.

3) Float

]]>
By: Edmar http://www.xaprb.com/blog/2011/01/02/finding-things-within-some-distance-in-sql/#comment-19032 Edmar Mon, 03 Jan 2011 23:29:00 +0000 http://www.xaprb.com/blog/?p=2133#comment-19032 Robert, thanks for the info! If you have the time, I’ve got a couple questions about it:

1) Which database are you using? MySQL?

2) How about the performance of the range query on latitude, longitude? I’m assuming the composite index is a regular B-tree (not spatial).

3) What datatype/precision do you use to store latitude and longitude?

Thanks!

]]>