Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Index blocks by number in the DB #780

@arkpar

Description

@arkpar

With #760 The blocks are indexed by hash in the database which has a negative impact on performance. Keeping blocks close to each other in the DB allows for better utilisation of the database cache and disk IO when querying ranges of blocks. We need to bring back the block-by-number DB scheme. The problem is that two blocks that are not yet finalized can share the same number. I can think of two ways to get around that:

  1. Store current unfinalized best blocks by number. Any extra blocks are stored with additional suffix or by hash. In case of chain reorg the blocks are re-inserted with new keys. This implementation looks more preferable unless chain reorgs are too frequent.

  2. Keep the blocks in the journal similar to state changes in state-db. On finalization the block is moved from the journal to the main storage with a proper key.

Metadata

Metadata

Assignees

Labels

I9-optimisationAn enhancement to provide better overall performance in terms of time-to-completion for a task.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions