diff --git a/ui/medashare/cli.py b/ui/medashare/cli.py index 6f40fce..b593e45 100644 --- a/ui/medashare/cli.py +++ b/ui/medashare/cli.py @@ -57,7 +57,7 @@ import re import shutil import socket 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 import string import subprocess @@ -925,7 +925,14 @@ def init_datastructs(f): cache = TagCache.load(cachefname) 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: if cache.modified: cache.store(cachefname)