Use blocks table, not header_cids, for getBlockNumber() #232
Dismiss Review
Are you sure you want to dismiss this review?
Labels
Clear labels
Epic
Integration tests
bug
critical
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
v5
wontfix
Copied from Github
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Something isn't working
Improvements or additions to documentation
This issue or pull request already exists
New feature or request
Good for newcomers
Extra attention is needed
This doesn't seem right
Further information is requested
This will not be worked on
An issue or PR manually copied from GitHub.
Breaking change that won't be backward compatible
Something is not working
Documentation changes
Improve existing functionality
New functionality
This is security issue
Issue or pull request related to testing
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cerc-io/ipld-eth-server#232
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
On our machines, the single most expensive query is:
This query touches gazillions of rows, almost certainly as a consequence of only having a BRIN index on header_cids.block_number.
Even using gibbon (which has a comparatively small DB vs rhino or vulture) the comparison is significant:
OLD:
NEW:
LGTM! Is the poor performance due to a combination of timescaleDB partitioning by
block_number+ using BRIN to indexblock_number, or is this a more general issue when doingORDER BYBRIN indexed columns?Note: we're also changing the BRIN => BTREE in v5 (due to this finding, previously mentioned by David). Once that is done, should we revert to querying
eth.header_cidssince it is a much smaller table?It's both. The lack of a b-tree index seems to lobotomize Timescale's query planner such that it looks in all partitions when only the highest block number range one would do. Then it also takes longer to scan each partition.
I'm not sure the size of the table matters. When executed efficiently this query will be very fast regardless of the size because it will only do one seek on the index.