[OSM-dev] osm2pgsql update

Frederik Ramm frederik at remote.org
Fri Nov 25 07:18:34 GMT 2011


Kai,

On 11/25/11 04:59, Kai Krueger wrote:
>> I introduced a "--drop" flag that makes osm2pgsql drop the temporary
>> tables after import, and also does not create the indexes on way id and
>> relation id that a --slim import normally created.
>
> Although not creating some of the indexes can have a huge impact (In some of
> my benchmarks creating the planet_ways_nodes index took more than half of
> the overall time for import) and thus the --drop option can be very helpful,
> do the indexes on way id and relation id count to those important indexes?

Indexes come in three classes I believe:

* spatial indexes on non-slim tables - these are always required, not 
for the import process itself but for later use.

* OSM id indexes on non-slim tables - these are required for applying 
diffs later; they should not be required during the initial import phase 
but as I wrote in my post, it seems that multipolygon processing 
requires the id index on the polygon table so that it can delete things 
created earlier. - Which means that we should probably create that index 
in non-slim mode as well!

* OSM id indexes on slim tables - these are all required if you plan to 
run updates. If you do *not* want to run updates, then I think that:

** index on _nodes table is required to build way geometries *unless* 
you have enough cache to hold all nodes;
** index on _ways table is required to build multipolygons;
** index on _relations table is currently not required because the 
geometry builder does not honour cascading relations, but it would be 
required if that happened.

> Do you see benefits from
> dropping the indexes on the output tables? I guess it does save you some
> space on disk which can be useful.

I always assumed that not creating an unneeded index would certainly not 
be *worse* for performance and thus didn't benchmark anything ;)

Bye
Frederik



More information about the dev mailing list