Optimise SQLite for reads
This commit is contained in:
parent
15fd589c6b
commit
9e20691b34
1 changed files with 16 additions and 2 deletions
|
@ -66,16 +66,30 @@ WSGI_APPLICATION = 'yamdl_playground.wsgi.application'
|
||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
|
# 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 = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': 'file:default-db?mode=memory&cache=shared',
|
'NAME': 'file:default-db?mode=memory&cache=shared',
|
||||||
"CONN_MAX_AGE": 600
|
"CONN_MAX_AGE": 600,
|
||||||
|
"OPTIONS": {
|
||||||
|
"init_command": db_init_command
|
||||||
|
}
|
||||||
},
|
},
|
||||||
'yamdl': {
|
'yamdl': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': 'file:yamdl-db?mode=memory&cache=shared',
|
'NAME': 'file:yamdl-db?mode=memory&cache=shared',
|
||||||
"CONN_MAX_AGE": 600
|
"CONN_MAX_AGE": 600,
|
||||||
|
"OPTIONS": {
|
||||||
|
"init_command": db_init_command
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue