Skip to content
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

perf: exclude streaming data when getting battery level #4286

Conversation

swiffer
Copy link
Contributor

@swiffer swiffer commented Oct 20, 2024

another performance fix - query detected to be "slow" / having high mean_exec_time via pg_stat_statements.

in difference to other queries the "Battery Level" in "Overview" dashboard is not filtering positions based on selected time range causing a filter over positions_date_index.

adding the condition ideal_battery_range_km is not null is ok here, reduces rows to scan drastically.

could be further optimized (not neccessary) if adding time range filter to positions subquery, however the value would be empty then if no data recorded in last 24 hours.

i wonder if positions_car_id_index and positions_date_index provide the best value as positions data is filtered by car & date in most cases and indexes cannot be combined. it might be benefitical to change those indexes similary to the change of the positions_drive_id_index in #3186

Copy link

netlify bot commented Oct 20, 2024

Deploy Preview for teslamate ready!

Name Link
🔨 Latest commit a6994a3
🔍 Latest deploy log https://app.netlify.com/sites/teslamate/deploys/6714b5690f4d8b0008d925b2
😎 Deploy Preview https://deploy-preview-4286--teslamate.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@swiffer swiffer changed the title perf: exclude streaming date when getting battery level perf: exclude streaming data when getting battery level Oct 20, 2024
@JakobLichterfeld JakobLichterfeld added enhancement New feature or request area:dashboard Related to a Grafana dashboard labels Oct 20, 2024
Copy link
Collaborator

@JakobLichterfeld JakobLichterfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect. Successfully tested. Thank you very much.

@JakobLichterfeld JakobLichterfeld merged commit d5cb2c6 into teslamate-org:master Oct 21, 2024
15 checks passed
@swiffer swiffer deleted the perf-exclude-streaming-data-battery-level-overview-dashboard branch October 21, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dashboard Related to a Grafana dashboard enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants