Performance increase with lots of recordings (#8525)

* Performance increase with lots of recordings

* Formatting + review

* Update 020_update_index_recordings.py

Formatting

* Feedback + check fix

* Update 020_update_index_recordings.py
This commit is contained in:
tpjanssen
2023-11-08 00:18:26 +01:00
committed by GitHub
parent cc5357a31a
commit 3359123364
4 changed files with 50 additions and 36 deletions

View File

@@ -35,7 +35,7 @@ class StorageMaintainer(threading.Thread):
if self.camera_storage_stats.get(camera, {}).get("needs_refresh", True):
self.camera_storage_stats[camera] = {
"needs_refresh": (
Recordings.select(fn.COUNT(Recordings.id))
Recordings.select(fn.COUNT("*"))
.where(Recordings.camera == camera, Recordings.segment_size > 0)
.scalar()
< 50