rustprooflabs / pgosm-flex

PgOSM Flex provides high quality OpenStreetMap datasets in PostGIS (Postgres) using the osm2pgsql Flex output.
MIT License
101 stars 20 forks source link

Move index creation to style files from post-processing SQL #276

Closed rustprooflabs closed 1 year ago

rustprooflabs commented 1 year ago

Details

osm2pgsql now supports creating indexes within the flex config (lua) files. It's a good time to review the default indexes created, there are a few new ones I think will be worth adding. One example is osm.road_line currently has a partial index on major.

CREATE INDEX ix_osm_road_line_major
    ON osm.road_line (major)
    WHERE major;

I think having similar indexes on the route_foot, route_cycle, and route_motor columns makes sense.

References

Docs: https://osm2pgsql.org/doc/manual.html#defining-indexes

Changes: https://github.com/openstreetmap/osm2pgsql/pull/1847/files#diff-9e83c8554b4c314f902bae63cec9cf2dfbebb3efab69cf8ebd76b38cd843b4ef