when create materialized do so without data, better logging

pull/131/head
stirringhalo 2017-01-04 01:03:00 -05:00
rodzic 0c1da27294
commit 2ef6a19149
4 zmienionych plików z 14 dodań i 10 usunięć

Wyświetl plik

@ -29,7 +29,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
WHERE (name <> '' OR ref <> '') AND NULLIF(highway, '') IS NOT NULL
GROUP BY name, highway, ref
) AS highway_union
);
) WITH NO DATA;
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_geometry_idx ON osm_transportation_name_linestring USING gist(geometry);
-- etldoc: osm_transportation_name_linestring -> osm_transportation_name_linestring_gen1
@ -37,7 +37,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen1 AS (
SELECT ST_Simplify(geometry, 50) AS geometry, osm_id, member_osm_ids, name, ref, highway, z_order
FROM osm_transportation_name_linestring
WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 8000
);
) WITH NO DATA;
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_geometry_idx ON osm_transportation_name_linestring_gen1 USING gist(geometry);
-- etldoc: osm_transportation_name_linestring_gen1 -> osm_transportation_name_linestring_gen2
@ -45,7 +45,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen2 AS (
SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, member_osm_ids, name, ref, highway, z_order
FROM osm_transportation_name_linestring_gen1
WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 14000
);
) WITH NO DATA;
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_geometry_idx ON osm_transportation_name_linestring_gen2 USING gist(geometry);
-- etldoc: osm_transportation_name_linestring_gen2 -> osm_transportation_name_linestring_gen3
@ -53,7 +53,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen3 AS (
SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, member_osm_ids, name, ref, highway, z_order
FROM osm_transportation_name_linestring_gen2
WHERE highway = 'motorway' AND ST_Length(geometry) > 20000
);
) WITH NO DATA;
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_geometry_idx ON osm_transportation_name_linestring_gen3 USING gist(geometry);
--- Triggers
@ -61,6 +61,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_geometry_idx
CREATE OR REPLACE FUNCTION refresh_osm_transportation_name_linestring() RETURNS trigger AS
$BODY$
BEGIN
RAISE LOG 'Refresh osm_highway_linestring based tables';
REFRESH MATERIALIZED VIEW osm_transportation_name_linestring;
REFRESH MATERIALIZED VIEW osm_transportation_name_linestring_gen1;
REFRESH MATERIALIZED VIEW osm_transportation_name_linestring_gen2;

Wyświetl plik

@ -8,7 +8,7 @@ CREATE MATERIALIZED VIEW osm_water_lakeline AS (
FROM osm_water_polygon AS wp
INNER JOIN lake_centerline ll ON wp.osm_id = ll.osm_id
WHERE wp.name <> ''
);
) WITH NO DATA;
CREATE INDEX IF NOT EXISTS osm_water_lakeline_geometry_idx ON osm_water_lakeline USING gist(geometry);
-- Triggers
@ -16,6 +16,7 @@ CREATE INDEX IF NOT EXISTS osm_water_lakeline_geometry_idx ON osm_water_lakeline
CREATE OR REPLACE FUNCTION refresh_osm_water_lakeline() RETURNS trigger AS
$BODY$
BEGIN
RAISE LOG 'Refresh osm_water_lakeline based tables';
REFRESH MATERIALIZED VIEW osm_water_lakeline;
RETURN null;
END;

Wyświetl plik

@ -8,7 +8,7 @@ CREATE MATERIALIZED VIEW osm_water_point AS (
FROM osm_water_polygon AS wp
LEFT JOIN lake_centerline ll ON wp.osm_id = ll.osm_id
WHERE ll.osm_id IS NULL AND wp.name <> ''
);
) WITH NO DATA;
CREATE INDEX IF NOT EXISTS osm_water_point_geometry_idx ON osm_water_point USING gist (geometry);
-- Triggers
@ -16,6 +16,7 @@ CREATE INDEX IF NOT EXISTS osm_water_point_geometry_idx ON osm_water_point USING
CREATE OR REPLACE FUNCTION refresh_osm_water_point() RETURNS trigger AS
$BODY$
BEGIN
RAISE LOG 'Refresh osm_water polygon based tables';
REFRESH MATERIALIZED VIEW osm_water_point;
RETURN null;
END;

Wyświetl plik

@ -16,7 +16,7 @@ CREATE MATERIALIZED VIEW osm_important_waterway_linestring AS (
WHERE name <> '' AND waterway = 'river'
GROUP BY name
) AS waterway_union
);
) WITH NO DATA;
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_geometry_idx ON osm_important_waterway_linestring USING gist(geometry);
-- etldoc: osm_important_waterway_linestring -> osm_important_waterway_linestring_gen1
@ -24,7 +24,7 @@ CREATE MATERIALIZED VIEW osm_important_waterway_linestring_gen1 AS (
SELECT ST_Simplify(geometry, 60) AS geometry, name
FROM osm_important_waterway_linestring
WHERE ST_Length(geometry) > 1000
);
) WITH NO DATA;
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_gen1_geometry_idx ON osm_important_waterway_linestring_gen1 USING gist(geometry);
-- etldoc: osm_important_waterway_linestring_gen1 -> osm_important_waterway_linestring_gen2
@ -32,7 +32,7 @@ CREATE MATERIALIZED VIEW osm_important_waterway_linestring_gen2 AS (
SELECT ST_Simplify(geometry, 100) AS geometry, name
FROM osm_important_waterway_linestring_gen1
WHERE ST_Length(geometry) > 4000
);
) WITH NO DATA;
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_gen2_geometry_idx ON osm_important_waterway_linestring_gen2 USING gist(geometry);
-- etldoc: osm_important_waterway_linestring_gen2 -> osm_important_waterway_linestring_gen3
@ -40,7 +40,7 @@ CREATE MATERIALIZED VIEW osm_important_waterway_linestring_gen3 AS (
SELECT ST_Simplify(geometry, 200) AS geometry, name
FROM osm_important_waterway_linestring_gen2
WHERE ST_Length(geometry) > 8000
);
) WITH NO DATA;
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_gen3_geometry_idx ON osm_important_waterway_linestring_gen3 USING gist(geometry);
--- Triggers
@ -48,6 +48,7 @@ CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_gen3_geometry_idx O
CREATE OR REPLACE FUNCTION refresh_osm_important_waterway_linestring() RETURNS trigger AS
$BODY$
BEGIN
RAISE LOG 'Refresh osm_waterway_linestring based tables';
REFRESH MATERIALIZED VIEW osm_important_waterway_linestring;
REFRESH MATERIALIZED VIEW osm_important_waterway_linestring_gen1;
REFRESH MATERIALIZED VIEW osm_important_waterway_linestring_gen2;