Compare commits

...

2 Commits

Author SHA1 Message Date
Sarah Hoffmann
c05b8f241c make sure we use exactly the same table structure as osm2pgsql 2025-12-31 00:21:27 +01:00
Sarah Hoffmann
da94d7eea3 need an analyse after the migration 2025-12-30 19:49:07 +01:00

View File

@@ -195,10 +195,10 @@ def create_place_postcode_table(conn: Connection, config: Configuration, **_: An
cur.execute(
"""
CREATE TABLE place_postcode (
osm_type VARCHAR(1),
osm_id BIGINT,
osm_type CHAR(1) NOT NULL,
osm_id BIGINT NOT NULL,
postcode TEXT NOT NULL,
country_code VARCHAR(2),
country_code TEXT,
centroid GEOMETRY(Point, 4326) NOT NULL,
geometry GEOMETRY(Geometry, 4326)
)
@@ -224,6 +224,11 @@ def create_place_postcode_table(conn: Connection, config: Configuration, **_: An
CREATE INDEX place_postcode_osm_id_idx ON place_postcode
USING BTREE (osm_type, osm_id)
""")
cur.execute(
"""
CREATE INDEX place_postcode_postcode_idx ON place_postcode
USING BTREE (postcode)
""")
cur.execute("ALTER TABLE place ENABLE TRIGGER ALL")
if not has_postcode_table:
sqlp.run_sql_file(conn, 'functions/postcode_triggers.sql')
@@ -343,4 +348,5 @@ def create_place_postcode_table(conn: Connection, config: Configuration, **_: An
CREATE INDEX idx_placex_geometry_placenode_nopostcode ON placex
USING SPGIST (geometry) {{db.tablespace.address_index}}
WHERE osm_type = 'N' and rank_search < 26 and class = 'place';
ANALYSE;
""")