Skip to content

perf(db): Sort transaction hash/nums before inserting them#21096

Closed
mediocregopher wants to merge 1 commit intomainfrom
mediocregopher/insert-tx-hash-numbers-sorted
Closed

perf(db): Sort transaction hash/nums before inserting them#21096
mediocregopher wants to merge 1 commit intomainfrom
mediocregopher/insert-tx-hash-numbers-sorted

Conversation

@mediocregopher
Copy link
Member

Sorting prior to insertion helps with locality when inserting into MDBX. When we migrate this data to rocksdb later it will also be helpful for perf to have it pre-sorted.

@mediocregopher
Copy link
Member Author

Going to rebase onto #20993

@github-project-automation github-project-automation bot moved this from Backlog to Done in Reth Tracker Jan 15, 2026
/// Puts multiple transaction hash number mappings from a pre-sorted slice.
///
/// The entries MUST be pre-sorted by transaction hash for optimal B-tree database performance.
/// Uses `cursor.upsert()` which handles arbitrary insertion order and duplicates.
Copy link
Member

Choose a reason for hiding this comment

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

I don't get it, why do we use upsert if we already require guarantee that the entries are presorted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants