mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-24 18:26:51 +03:00
* rename migration * use ASC composite index for event camera and start_time the planner still picks for newest-first single-camera queries but doesn't slow down full per-camera scans on a cold cache * pause playback while the timeline range handles are up * reduce multi camera seeded export range to 30m allows both handlebars to fit within most desktop windows
22 lines
506 B
Python
22 lines
506 B
Python
"""Peewee migrations -- 039_add_perf_indexes.py.
|
|
|
|
Adds a composite (camera, start_time) index to speed up single-camera queries
|
|
issued by the web UI.
|
|
|
|
"""
|
|
|
|
import peewee as pw
|
|
|
|
SQL = pw.SQL
|
|
|
|
|
|
def migrate(migrator, database, fake=False, **kwargs):
|
|
migrator.sql(
|
|
'CREATE INDEX IF NOT EXISTS "event_camera_start_time" '
|
|
'ON "event" ("camera", "start_time")'
|
|
)
|
|
|
|
|
|
def rollback(migrator, database, fake=False, **kwargs):
|
|
migrator.sql('DROP INDEX IF EXISTS "event_camera_start_time"')
|