From 191713730c33f19854186b0e62c598e6fbc156fa Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Mon, 16 Dec 2024 22:31:31 +0100 Subject: [PATCH] index on center and buffered geometries --- import/sql/get_station_importance.sql | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/import/sql/get_station_importance.sql b/import/sql/get_station_importance.sql index 972c3fe7..9ab73fee 100644 --- a/import/sql/get_station_importance.sql +++ b/import/sql/get_station_importance.sql @@ -61,7 +61,14 @@ CREATE OR REPLACE VIEW station_nodes_platforms_rel_count AS -- or about 20 to 30 minutes for the whole planet CREATE MATERIALIZED VIEW IF NOT EXISTS stations_with_route_counts AS SELECT - *, + id, + osm_id, + name, + station, + railway_ref, + railway, + route_count, + name_tags, ST_Centroid(way) as center, ST_Buffer(ST_ConvexHull(way), 50) as buffered, ST_NumGeometries(way) as count @@ -101,6 +108,10 @@ CREATE MATERIALIZED VIEW IF NOT EXISTS stations_with_route_counts AS ORDER BY name, station, railway_ref, railway, route_count DESC ) as source_facilities; -CREATE INDEX IF NOT EXISTS stations_with_route_counts_geom_index +CREATE INDEX IF NOT EXISTS stations_with_route_counts_center_index ON stations_with_route_counts - USING GIST(way); + USING GIST(center); + +CREATE INDEX IF NOT EXISTS stations_with_route_counts_buffered_index + ON stations_with_route_counts + USING GIST(buffered);