pnorman / openstreetmap-cartographic

A port of OpenStreetMap Carto to Mapbox GL for client-side rendering
Other
58 stars 4 forks source link

Add index on ST_PointOnSurface #12

Open pnorman opened 3 years ago

pnorman commented 3 years ago

Generating z12 spends a lot of time on the protected-area-names and admin-names layers. These are selecting ST_PointOnSurface(way) with a name IS NOT NULL condition, and, depending on layer, either way_area > 957254.744709896 or way_area > 239313.686177474.

An index on ST_PointOnSurface where name is not null would help with these queries by returning fewer rows, and meaning that an expensive ST_PointOnSurface would not need to be computed for all tiles intersecting large admin or protected area polygons

pnorman commented 3 years ago

Thinking about it, the condition should be a name IS NOT NULL OR ref IS NOT NULL