| @@ -57,7 +57,7 @@ import re | |||||
| import shutil | import shutil | ||||
| import socket | import socket | ||||
| import sqlalchemy | import sqlalchemy | ||||
| from sqlalchemy import create_engine, select, insert, func, delete | |||||
| from sqlalchemy import create_engine, select, insert, func, delete, text | |||||
| from sqlalchemy.orm import sessionmaker, aliased, load_only | from sqlalchemy.orm import sessionmaker, aliased, load_only | ||||
| import string | import string | ||||
| import subprocess | import subprocess | ||||
| @@ -925,7 +925,14 @@ def init_datastructs(f): | |||||
| cache = TagCache.load(cachefname) | cache = TagCache.load(cachefname) | ||||
| try: | try: | ||||
| return f(options, persona, objstr, cache) | |||||
| r = f(options, persona, objstr, cache) | |||||
| # per: https://www.sqlite.org/lang_analyze.html | |||||
| with engine.connect() as con: | |||||
| con.execute(text('PRAGMA analysis_limit = 400;')) | |||||
| con.execute(text('PRAGMA optimize;')) | |||||
| con.commit() | |||||
| return r | |||||
| finally: | finally: | ||||
| if cache.modified: | if cache.modified: | ||||
| cache.store(cachefname) | cache.store(cachefname) | ||||