-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance increase with lots of recordings #8525
Conversation
✅ Deploy Preview for frigate-docs canceled.
|
@@ -1584,20 +1584,10 @@ def recordings_summary(camera_name): | |||
) | |||
.where(Recordings.camera == camera_name) | |||
.group_by( | |||
fn.strftime( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is removing the timezone handling for recordings which is incorrect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why so? Grouping is done by the hour, which does not depend on timezone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it does depend on the timezone, the api accepts a timezone query arg which affects how hours are displayed. That timezone query arg is now just ignored in this implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't ignored, it is still in the select part of the query. Only grouping is now done based on the Unix epoch, the output of the query is exactly the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you're saying, this will still cause problems for timezones that have 30 minute and 15 minute offsets from UTC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could perhaps catch the case that minute_modifier
is not 0 and use the current grouping in that case or if it is 0 use your new grouping
@@ -0,0 +1,44 @@ | |||
"""Peewee migrations -- 011_update_indexes.py. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Title should be updated here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy paste error. Will change it.
@@ -1584,20 +1584,10 @@ def recordings_summary(camera_name): | |||
) | |||
.where(Recordings.camera == camera_name) | |||
.group_by( | |||
fn.strftime( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could perhaps catch the case that minute_modifier
is not 0 and use the current grouping in that case or if it is 0 use your new grouping
The difference on my side was even bigger. All depends on the number of recordings of course. Visiting the storage page on the frontend is also a lot quicker, refreshes are nearly instant at my side. |
I noticed long query times on my database with lots of recordings, therefore I changed some code and databases indices. I see a serious performance increase on all queries running on the recordings table.