[OSM-dev] getnodes index?

Christopher Schmidt crschmidt at crschmidt.net
Fri Jun 9 14:14:10 BST 2006


I'm porting the getnodes query to Python for my planet stuff, and I was
having the SQL queries take *much* longer than I expected. I then did an
explain on the query, and it said that it wasn't using the
longitude/latitude key when doing a query. Adding seperate indices for
lat/lon made the query move from 7 minutes (for a .01 x .01 degree area)
to less than 1sec. 

I'm assuming that this isn't the case on the main OSM server, but for
me:

alter table nodes add index nodes_lon_idx (longitude);
alter table nodes add index nodes_lat_idx (latitude);

Makes everything a lot faster. You might want to try this if you've got
a local version of the OSM db.

-- 
Christopher Schmidt
Web Developer




More information about the dev mailing list