From: Sarah Hoffmann Date: Fri, 10 Jan 2025 15:44:18 +0000 (+0100) Subject: Merge pull request #3631 from lonvia/avoid-transactions X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/4523b9aaedb0074a2af1f1932841e55878a047a6?hp=8b1cabebd653b7c338d84bf289d40156e90b4e05 Merge pull request #3631 from lonvia/avoid-transactions Creating tables and indexes in autocommit mode --- diff --git a/src/nominatim_db/clicmd/setup.py b/src/nominatim_db/clicmd/setup.py index 39cbe65a..fb193838 100644 --- a/src/nominatim_db/clicmd/setup.py +++ b/src/nominatim_db/clicmd/setup.py @@ -122,13 +122,16 @@ class SetupAll: LOG.warning('Post-process tables') with connect(args.config.get_libpq_dsn()) as conn: + conn.autocommit = True await database_import.create_search_indices(conn, args.config, drop=args.no_updates, threads=num_threads) LOG.warning('Create search index for default country names.') + conn.autocommit = False country_info.create_country_names(conn, tokenizer, args.config.get_str_list('LANGUAGES')) if args.no_updates: + conn.autocommit = True freeze.drop_update_tables(conn) tokenizer.finalize_import(args.config) @@ -183,6 +186,7 @@ class SetupAll: from ..tools import database_import, refresh with connect(config.get_libpq_dsn()) as conn: + conn.autocommit = True LOG.warning('Create functions (1st pass)') refresh.create_functions(conn, config, False, False) LOG.warning('Create tables')