[OSM-dev] Too many slow queries in db

Tom Hughes tom at compton.nu
Tue Sep 4 11:55:47 BST 2007


In message <46DD35ED.4080308 at frankieandshadow.com>
        David Earl <david at frankieandshadow.com> wrote:

> On 04/09/2007 11:21, Tom Hughes wrote:
>> The slow queries will essentially all be along the lines of:
>> 
>>   SELECT ... FROM current_nodes
>>   WHERE latitude BETWEEN ... AND ...
>>     AND longitude BETWEEN ... AND ...
>
>
> The way I addressed this problem in the name finder was to create a 
> "region number". Each region is about 111km square: 1 degree of latitude 
>   and gradually decreasing amounts of longitude away from the equator. 
> The number of each region is 1000 * lat + f(lon), so given a lat,lon it 
> is easy to get the region number. It is also easy to compute the 
> neighbouring region numbers.

That's essentially what the quadtile idea does, but regions are
effectively nested so that range of region numbers is actually a
bigger region so you can choose how big or small a region to read.

Tom

-- 
Tom Hughes (tom at compton.nu)
http://www.compton.nu/




More information about the dev mailing list