1
Fork 0

Optimise SQLite for reads

This commit is contained in:
Jake Howard 2024-08-24 16:35:12 +01:00
parent 15fd589c6b
commit 9e20691b34
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -66,16 +66,30 @@ WSGI_APPLICATION = 'yamdl_playground.wsgi.application'
# Database
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
db_init_command = """
PRAGMA journal_mode=OFF;
PRAGMA synchronous=OFF;
PRAGMA mmap_size = 134217728;
PRAGMA cache_size=4000;
PRAGMA temp_store=MEMORY;
"""
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'file:default-db?mode=memory&cache=shared',
"CONN_MAX_AGE": 600
"CONN_MAX_AGE": 600,
"OPTIONS": {
"init_command": db_init_command
}
},
'yamdl': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'file:yamdl-db?mode=memory&cache=shared',
"CONN_MAX_AGE": 600
"CONN_MAX_AGE": 600,
"OPTIONS": {
"init_command": db_init_command
}
}
}