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

Improve findAggregateContractMetric performance and introduce 30 second granularity for contract metrics #1006

Merged
merged 5 commits into from
Feb 29, 2024

Conversation

ChrisSchinnerl
Copy link
Member

After doing some manual testing on Arequipa with about 34 million recorded contract metrics, I noticed that using multiple simpler queries (one select per contract per period) is a lot faster when combined with a composite index than a single more complex query.

This PR reduces the time it takes to display the contracts graph from about 25s down to <1s on the current set of data.

Combined with the granularity change of only recording one metric per contract every 5 minutes, a large host like Arequipa should only produce around 30 million rows a year.

@ChrisSchinnerl ChrisSchinnerl self-assigned this Feb 28, 2024
@ChrisSchinnerl ChrisSchinnerl marked this pull request as ready for review February 28, 2024 09:26
stores/metrics.go Outdated Show resolved Hide resolved
stores/metrics.go Show resolved Hide resolved
Co-authored-by: Peter-Jan Brone <[email protected]>
@peterjan
Copy link
Member

upload_test.go:246: expected 2 packed slab 👀 new NDF, I'll check it out

@ChrisSchinnerl ChrisSchinnerl merged commit 65f16ff into dev Feb 29, 2024
8 checks passed
@ChrisSchinnerl ChrisSchinnerl deleted the chris/aggregate-contract-speedup branch February 29, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants