]> git.openstreetmap.org Git - nominatim.git/blob - lib-sql/tiger_import_finish.sql
add index for Tiger housenumber queries
[nominatim.git] / lib-sql / tiger_import_finish.sql
1 --index only on parent_place_id
2 CREATE INDEX IF NOT EXISTS idx_location_property_tiger_parent_place_id_imp
3   ON location_property_tiger_import (parent_place_id)
4 {% if postgres.has_index_non_key_column %}
5   INCLUDE (startnumber, endnumber)
6 {% endif %}
7   {{db.tablespace.aux_index}};
8 CREATE UNIQUE INDEX IF NOT EXISTS idx_location_property_tiger_place_id_imp
9   ON location_property_tiger_import (place_id) {{db.tablespace.aux_index}};
10
11 GRANT SELECT ON location_property_tiger_import TO "{{config.DATABASE_WEBUSER}}";
12
13 DROP TABLE IF EXISTS location_property_tiger;
14 ALTER TABLE location_property_tiger_import RENAME TO location_property_tiger;
15
16 ALTER INDEX IF EXISTS idx_location_property_tiger_parent_place_id_imp RENAME TO idx_location_property_tiger_housenumber_parent_place_id;
17 ALTER INDEX IF EXISTS idx_location_property_tiger_place_id_imp RENAME TO idx_location_property_tiger_place_id;
18
19 DROP FUNCTION tiger_line_import (linegeo GEOMETRY, in_startnumber INTEGER,
20                                  in_endnumber INTEGER, interpolationtype TEXT,
21                                  token_info JSONB, in_postcode TEXT);