Added few partial index to speed up creating materialized views in transportation merge_highways.

pull/213/head
MartinMikita 2017-03-28 16:27:34 +02:00 zatwierdzone przez Jiri Kozel
rodzic cfc65c6884
commit 2996987e70
1 zmienionych plików z 18 dodań i 0 usunięć

Wyświetl plik

@ -13,6 +13,16 @@ DROP TRIGGER IF EXISTS trigger_refresh ON transportation.updates;
-- etldoc: osm_highway_linestring -> osm_transportation_merge_linestring
-- Improve performance of the sql in transportation_name/network_type.sql
CREATE INDEX IF NOT EXISTS osm_highway_linestring_highway_idx
ON osm_highway_linestring(highway);
-- Improve performance of the sql below
CREATE INDEX IF NOT EXISTS osm_highway_linestring_highway_partial_idx
ON osm_highway_linestring(highway)
WHERE highway IN ('motorway','trunk');
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring AS (
SELECT
(ST_Dump(geometry)).geom AS geometry,
@ -34,6 +44,10 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring AS (
) AS highway_union
);
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_geometry_idx ON osm_transportation_merge_linestring USING gist(geometry);
-- Improve performance of the sql below
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_highway_partial_idx
ON osm_transportation_merge_linestring(highway)
WHERE highway IN ('motorway','trunk');
-- etldoc: osm_transportation_merge_linestring -> osm_transportation_merge_linestring_gen5
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen5 AS (
@ -42,6 +56,10 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen5 AS (
WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 20000
);
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen5_geometry_idx ON osm_transportation_merge_linestring_gen5 USING gist(geometry);
-- Improve performance of the sql below
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen5_highway_partial_idx
ON osm_transportation_merge_linestring_gen5(highway)
WHERE highway IN ('motorway');
-- etldoc: osm_transportation_merge_linestring_gen5 -> osm_transportation_merge_linestring_gen6
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen6 AS (