mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-10 10:33:11 +03:00
Pivot per audit: add nginx vod_response_cache, drop premature DB indexes
- Add vod_response_cache (64m) to nginx-vod-module config, directly targeting the maintainer-identified bottleneck of manifest/playlist generation on historical playback cold opens - Remove migration 036 (composite recording indexes) — existing indexes are already sufficient; schema expansion deferred until profiling justifies it This aligns with the V2 limited-scope patch plan: 1. nginx VOD response cache (this commit) 2. vod_ts overlap predicate rewrite (prior commit) 3. in-process historical mapping memoization (prior commit) 4. sibling path cleanup in recording_clip (prior commit) https://claude.ai/code/session_01XeVxvSk9ywyPBR288ZZXWE
This commit is contained in:
parent
89adfe19e0
commit
fd99121408
@ -94,6 +94,7 @@ http {
|
||||
# vod caches
|
||||
vod_metadata_cache metadata_cache 512m;
|
||||
vod_mapping_cache mapping_cache 5m 10m;
|
||||
vod_response_cache response_cache 64m;
|
||||
|
||||
# gzip manifests
|
||||
gzip on;
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
"""Peewee migrations -- 036_add_recordings_vod_indexes.py.
|
||||
|
||||
Add indexes to the recordings table optimized for the VOD overlap query:
|
||||
WHERE camera = ? AND end_time > ? AND start_time < ?
|
||||
ORDER BY start_time ASC
|
||||
|
||||
The composite index (camera, start_time, end_time) covers the full predicate
|
||||
and ordering in a single B-tree walk. The (camera, end_time) index gives the
|
||||
planner an alternative access path for the end_time > ? filter.
|
||||
"""
|
||||
|
||||
import peewee as pw
|
||||
|
||||
SQL = pw.SQL
|
||||
|
||||
|
||||
def migrate(migrator, database, fake=False, **kwargs):
|
||||
migrator.sql(
|
||||
'CREATE INDEX IF NOT EXISTS "idx_recordings_camera_start_end" '
|
||||
'ON "recordings" ("camera", "start_time", "end_time")'
|
||||
)
|
||||
migrator.sql(
|
||||
'CREATE INDEX IF NOT EXISTS "idx_recordings_camera_end" '
|
||||
'ON "recordings" ("camera", "end_time")'
|
||||
)
|
||||
|
||||
|
||||
def rollback(migrator, database, fake=False, **kwargs):
|
||||
migrator.sql('DROP INDEX IF EXISTS "idx_recordings_camera_start_end"')
|
||||
migrator.sql('DROP INDEX IF EXISTS "idx_recordings_camera_end"')
|
||||
Loading…
Reference in New Issue
Block a user