[OSM-dev] getnodes index?
sxpert at esitcom.org
Sat Jun 10 07:45:30 BST 2006
Christopher Schmidt wrote:
> 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
> 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.
if your DB server supports spatial extensions (mysql 5.x or postgres
8.x) using the dedicated data types like points and R-Tree indexes, it
should make it even faster to index
(using the GIST r-tree implementation)
see my example at:
More information about the dev