diff --git a/lib-sql/indices.sql b/lib-sql/indices.sql index 8c176fdf8..4d92452d1 100644 --- a/lib-sql/indices.sql +++ b/lib-sql/indices.sql @@ -31,6 +31,7 @@ CREATE INDEX IF NOT EXISTS idx_placex_geometry ON placex -- Index is needed during import but can be dropped as soon as a full -- geometry index is in place. The partial index is almost as big as the full -- index. +--- DROP INDEX IF EXISTS idx_placex_geometry_lower_rank_ways; --- CREATE INDEX IF NOT EXISTS idx_placex_geometry_reverse_lookupPolygon @@ -60,7 +61,6 @@ CREATE INDEX IF NOT EXISTS idx_postcode_postcode --- DROP INDEX IF EXISTS idx_placex_geometry_address_area_candidates; DROP INDEX IF EXISTS idx_placex_geometry_buildings; - DROP INDEX IF EXISTS idx_placex_geometry_lower_rank_ways; DROP INDEX IF EXISTS idx_placex_wikidata; DROP INDEX IF EXISTS idx_placex_rank_address_sector; DROP INDEX IF EXISTS idx_placex_rank_boundaries_sector; diff --git a/src/nominatim_db/db/query_pool.py b/src/nominatim_db/db/query_pool.py index 3f0d7a80b..2828937f9 100644 --- a/src/nominatim_db/db/query_pool.py +++ b/src/nominatim_db/db/query_pool.py @@ -21,6 +21,8 @@ class QueryPool: """ Pool to run SQL queries in parallel asynchronous execution. + All queries are run in autocommit mode. If parallel execution leads + to a deadlock, then the query is repeated. The results of the queries is discarded. """ def __init__(self, dsn: str, pool_size: int = 1, **conn_args: Any) -> None: @@ -50,8 +52,14 @@ async def finish(self) -> None: await asyncio.wait(self.pool) self.wait_time += time.time() - tstart + for task in self.pool: + excp = task.exception() + if excp is not None: + raise excp + async def _worker_loop(self, dsn: str, **conn_args: Any) -> None: + conn_args['autocommit'] = True aconn = await psycopg.AsyncConnection.connect(dsn, **conn_args) async with aconn: async with aconn.cursor() as cur: