Use blocks table, not header_cids, for getBlockNumber() #232
Labels
No Label
bug
critical
documentation
duplicate
enhancement
Epic
good first issue
help wanted
Integration tests
invalid
question
v5
wontfix
Copied from Github
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cerc-io/ipld-eth-server#232
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "telackey/blocks"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 BY
BRIN 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_cids
since 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.