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

Performance fixes - limit block search space and filter blocks earlier in query #114

Merged
merged 8 commits into from
Jan 27, 2025

Conversation

45930
Copy link
Contributor

@45930 45930 commented Jan 20, 2025

Summary

Mainnet usage of this API has exposed a performance issue where a simple request for events or actions on an account will scan the entire history of the blockchain by default. This creates a postgres query that takes quite some time (several minutes) to execute. At scale, this can turn into a database which is using all available read connections to process expensive queries and cannot accept a new connection event to execute a cheaper query.

Solution

This PR sets a maximum block range size and moves that filter to the top of the query so that the rest of the queries and graphQL resolver code is operating over a small set.

@45930 45930 requested a review from boray January 21, 2025 21:44
@45930 45930 marked this pull request as ready for review January 21, 2025 21:45
@45930 45930 changed the title Quick performance tweaks Performance fixes - limit block search space and filter blocks earlier in query Jan 27, 2025
@45930 45930 merged commit eecdea0 into main Jan 27, 2025
4 checks passed
@45930 45930 deleted the 2025-01-perf branch January 27, 2025 22:38
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.

2 participants