Performance: GZip, Cache-Control, WebP, SQLite-Tuning, Indizes, srcset — SW by-v438, APP_VER 417
This commit is contained in:
parent
5bd07d9598
commit
e0c2b2bdc1
10 changed files with 46 additions and 12 deletions
|
|
@ -26,6 +26,9 @@ def get_connection() -> sqlite3.Connection:
|
|||
conn.execute("PRAGMA journal_mode=WAL")
|
||||
conn.execute("PRAGMA foreign_keys=ON")
|
||||
conn.execute("PRAGMA busy_timeout=5000")
|
||||
conn.execute("PRAGMA cache_size = -32000") # 32MB Page-Cache
|
||||
conn.execute("PRAGMA temp_store = MEMORY") # Temp-Tabellen im RAM statt auf Disk
|
||||
conn.execute("PRAGMA mmap_size = 268435456") # 256MB Memory-Mapped I/O
|
||||
conn.create_function('norm', 1, _norm)
|
||||
return conn
|
||||
|
||||
|
|
@ -1212,3 +1215,11 @@ def _migrate(conn_factory):
|
|||
)
|
||||
""")
|
||||
logger.info("Migration: dogs.gewicht_kg aus health synchronisiert.")
|
||||
|
||||
# Performance-Indizes für häufige Queries
|
||||
conn.execute("CREATE INDEX IF NOT EXISTS idx_health_naechstes ON health(naechstes) WHERE naechstes IS NOT NULL")
|
||||
conn.execute("CREATE INDEX IF NOT EXISTS idx_ki_calls_user_date ON ki_daily_calls(user_id, date)")
|
||||
conn.execute("CREATE INDEX IF NOT EXISTS idx_events_user_datum ON events(user_id, datum)")
|
||||
conn.execute("CREATE INDEX IF NOT EXISTS idx_diary_created ON diary(dog_id, created_at DESC)")
|
||||
conn.execute("CREATE INDEX IF NOT EXISTS idx_notes_created ON notes(user_id, created_at DESC)")
|
||||
logger.info("Migration: Performance-Indizes bereit.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue