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

optimize daily active accounts query #622

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

Andrew7234
Copy link
Collaborator

@Andrew7234 Andrew7234 commented Feb 1, 2024

Resolves #862.

Query changed as suggested by @pro-wh

@Andrew7234 Andrew7234 force-pushed the andrew7234/active-account-stats branch from 3e0bc2c to 7625597 Compare February 1, 2024 20:03
Copy link
Collaborator

@pro-wh pro-wh left a comment

Choose a reason for hiding this comment

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

as discussed.

👍 on semi-open interval tweak

Copy link
Contributor

@mitjat mitjat left a comment

Choose a reason for hiding this comment

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

🙌

Thank you both for figuring this one out!

The biggest surprise to me (from conversation in Slack) is that with the old query, postgres was not wanting to walk the timestamp index in order to find all the blocks that belong to a specific 24h hour period. It apparently (wrongly) estimated that there will be too many such blocks. LIMIT 1 is really nice and explicit.

analyzer/aggregate_stats/queries.go Outdated Show resolved Hide resolved
address comments
@Andrew7234 Andrew7234 force-pushed the andrew7234/active-account-stats branch from 7625597 to 85d1ab6 Compare February 2, 2024 01:13
@Andrew7234 Andrew7234 enabled auto-merge February 2, 2024 01:15
@Andrew7234 Andrew7234 merged commit d9d1309 into main Feb 2, 2024
9 checks passed
@Andrew7234 Andrew7234 deleted the andrew7234/active-account-stats branch February 2, 2024 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

query timing out: daily active users
3 participants