-
Notifications
You must be signed in to change notification settings - Fork 17
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
bug: api endpoints dealing with blocks are too slow in stg #1382
Comments
but fetching one specific block, like |
With the backup sql file you provided, I wrote a small benchmark to measure how slow the query is, mimicking your REST query with
So there are some good and bad news. Let's start with the good news - simply removing the
The bad news is that counting over an entire table in sqlite will always be slow for huge tables. Even in the best case scenario, where we just count all rows via And the counting over the entire table scales worse with more complex queries like yours. Because the You basically cannot have filtering (or searching) SQL queries which also count the total number of results. Because, for SQL to compute that, it needs to search the entire table. So any I think the simplest solution for this query is to drop the |
thanks! |
since merging #1329 performance regressed significantly, this was not noticed in dev (with <10k blocks), only in stage (>1M blocks indexed), so it must be due to the table size
could you take a look @mvdan?
vocdoni-node/vochain/indexer/queries/blocks.sql
Lines 24 to 46 in b34b5bb
The text was updated successfully, but these errors were encountered: