Skip to content

Use CDB for historic records#1270

Open
oren-z0 wants to merge 8 commits intoromanz:masterfrom
oren-z0:cdb
Open

Use CDB for historic records#1270
oren-z0 wants to merge 8 commits intoromanz:masterfrom
oren-z0:cdb

Conversation

@oren-z0
Copy link

@oren-z0 oren-z0 commented Feb 21, 2026

RocksDB is a great key-value storage for mutable data, but most data in Bitcoin is immutable.
CDB64 is a very fast database for immutable data - using reference tables like this:

image

Originally CDB uses 32bits pointers, but cdb64 uses 64bits, source: https://www.unixuser.org/~euske/doc/cdbinternals/index.html.

Building the reference tables is a slow process, so the CDB can't replace RocksDB for fresh data. For example, we can store all the data up to block 900,000 in CDBs, and on query, search for it both in the CDB and the much-smaller RocksDB.

I haven't run benchmarks yet.

@oren-z0 oren-z0 force-pushed the cdb branch 2 times, most recently from 073486f to 7ae2b47 Compare February 21, 2026 12:52
Also update rust version to 1.88.0 - Required by
cdb64 0.2.0, which uses let chain expressions
(stabilized in Rust 1.88.0).
@oren-z0 oren-z0 force-pushed the cdb branch 2 times, most recently from 3791257 to 5bce34d Compare February 21, 2026 13:22
@romanz
Copy link
Owner

romanz commented Feb 21, 2026

Please consider retargeting this PR to https://github.com/romanz/bindex - electrs will migrate to use bindex soon: #1252

@oren-z0 oren-z0 force-pushed the cdb branch 2 times, most recently from ab777b4 to 8543def Compare February 21, 2026 14:40
There are still duplications between the RocksDB and the cdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants