diff --git a/yamdl_playground/core/apps.py b/yamdl_playground/core/apps.py index 5ed3227..83dcd7e 100644 --- a/yamdl_playground/core/apps.py +++ b/yamdl_playground/core/apps.py @@ -33,5 +33,9 @@ class CoreConfig(AppConfig): def post_save(self, sender, instance, created, **kwargs): if not created: return + with connections["default"].cursor() as cursor: cursor.execute("INSERT INTO search_index(body, rowid) VALUES (%s, %s)", [strip_tags(instance.content), instance.pk]) + + with connections["default"].cursor() as cursor: + cursor.execute("PRAGMA optimise;") diff --git a/yamdl_playground/settings.py b/yamdl_playground/settings.py index f054a8d..fb95167 100644 --- a/yamdl_playground/settings.py +++ b/yamdl_playground/settings.py @@ -72,6 +72,7 @@ PRAGMA synchronous=OFF; PRAGMA mmap_size = 134217728; PRAGMA cache_size=4000; PRAGMA temp_store=MEMORY; +PRAGMA auto_vacuum=INCREMENTAL; """ DATABASES = {