1 -- SPDX-License-Identifier: GPL-2.0-only
3 -- This file is part of Nominatim. (https://nominatim.org)
5 -- Copyright (C) 2026 by the Nominatim developer community.
6 -- For a full list of authors see the git log.
8 drop table IF EXISTS search_name_blank CASCADE;
9 CREATE TABLE search_name_blank (
10 place_id BIGINT NOT NULL,
11 address_rank smallint NOT NULL,
12 name_vector integer[] NOT NULL,
13 centroid GEOMETRY(Geometry, 4326) NOT NULL
16 {% for partition in db.partitions %}
17 CREATE TABLE location_area_large_{{ partition }} () INHERITS (location_area_large) {{db.tablespace.address_data}};
18 CREATE INDEX idx_location_area_large_{{ partition }}_place_id
19 ON location_area_large_{{ partition }}
20 USING BTREE (place_id) {{db.tablespace.address_index}};
21 CREATE INDEX idx_location_area_large_{{ partition }}_geometry
22 ON location_area_large_{{ partition }}
23 USING GIST (geometry) {{db.tablespace.address_index}};
25 CREATE TABLE search_name_{{ partition }} () INHERITS (search_name_blank) {{db.tablespace.address_data}};
26 CREATE UNIQUE INDEX idx_search_name_{{ partition }}_place_id
27 ON search_name_{{ partition }}
28 USING BTREE (place_id) {{db.tablespace.address_index}};
29 CREATE INDEX idx_search_name_{{ partition }}_centroid_street
30 ON search_name_{{ partition }} USING GIST (centroid) {{db.tablespace.address_index}}
31 WHERE address_rank between 26 and 27;
32 CREATE INDEX idx_search_name_{{ partition }}_centroid_place
33 ON search_name_{{ partition }} USING GIST (centroid) {{db.tablespace.address_index}}
34 WHERE address_rank between 2 and 25;
36 DROP TABLE IF EXISTS location_road_{{ partition }};
37 CREATE TABLE location_road_{{ partition }} (
38 place_id BIGINT NOT NULL,
39 partition SMALLINT NOT NULL,
40 country_code VARCHAR(2),
41 geometry GEOMETRY(Geometry, 4326) NOT NULL
42 ) {{db.tablespace.address_data}};
43 CREATE INDEX idx_location_road_{{ partition }}_geometry
44 ON location_road_{{ partition }}
45 USING GIST (geometry) {{db.tablespace.address_index}};
46 CREATE UNIQUE INDEX idx_location_road_{{ partition }}_place_id
47 ON location_road_{{ partition }}
48 USING BTREE (place_id) {{db.tablespace.address_index}};