]> git.openstreetmap.org Git - nominatim.git/commitdiff
add migration for reorganization of pending indexes
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 23 Nov 2022 09:55:39 +0000 (10:55 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 24 Nov 2022 07:48:05 +0000 (08:48 +0100)
Fixes #2900.

nominatim/tools/migration.py
nominatim/version.py

index d580609793bdd411999ee2fd95507c824fe37cc7..147a9f9c3c5faa28d1a275ac85437e39cc154f26 100644 (file)
@@ -332,3 +332,19 @@ def add_place_deletion_todo_table(conn: Connection, **_: Any) -> None:
                              class TEXT,
                              type TEXT,
                              deferred BOOLEAN)""")
+
+
+@_migration(4, 1, 99, 1)
+def split_pending_index(conn: Connection, **_: Any) -> None:
+    """ Reorganise indexes for pending updates.
+    """
+    if conn.table_exists('place'):
+        with conn.cursor() as cur:
+            cur.execute("""CREATE INDEX IF NOT EXISTS idx_placex_rank_address_sector
+                           ON placex USING BTREE (rank_address, geometry_sector)
+                           WHERE indexed_status > 0""")
+            cur.execute("""CREATE INDEX IF NOT EXISTS idx_placex_rank_boundaries_sector
+                           ON placex USING BTREE (rank_search, geometry_sector)
+                           WHERE class = 'boundary' and type = 'administrative'
+                                 and indexed_status > 0""")
+            cur.execute("DROP INDEX IF EXISTS idx_placex_pendingsector")
index 36573040f99e41924553029cf59657b296820100..58b70841c927e050c26c2a3fa22a44f7ab30ca7c 100644 (file)
@@ -25,7 +25,7 @@ from typing import Optional, Tuple
 # patch level when cherry-picking the commit with the migration.
 #
 # Released versions always have a database patch level of 0.
-NOMINATIM_VERSION = (4, 1, 99, 0)
+NOMINATIM_VERSION = (4, 1, 99, 1)
 
 POSTGRESQL_REQUIRED_VERSION = (9, 6)
 POSTGIS_REQUIRED_VERSION = (2, 2)