Optimise DB after insert
This commit is contained in:
parent
9e20691b34
commit
d43cfd2224
2 changed files with 5 additions and 0 deletions
|
@ -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;")
|
||||
|
|
|
@ -72,6 +72,7 @@ PRAGMA synchronous=OFF;
|
|||
PRAGMA mmap_size = 134217728;
|
||||
PRAGMA cache_size=4000;
|
||||
PRAGMA temp_store=MEMORY;
|
||||
PRAGMA auto_vacuum=INCREMENTAL;
|
||||
"""
|
||||
|
||||
DATABASES = {
|
||||
|
|
Loading…
Reference in a new issue