erigontech / erigontech/silkworm
Inefficient TxLookup prune
Open
- Dominant language
- C++
- Stars
- 318
- Forks
- 84
- PR merge metrics
- No merged PRs in 30d
Description
The [prune function for tx lookups](https://github.com/torquem-ch/silkworm/blob/master/node/silkworm/stagedsync/stage_tx_lookup.cpp#L194-L217) seems to me quite inefficient.
Basically it **traverses all records** from `BlockTransactionLookup` bucket in search of linked block numbers which are below the pruning threshold. That table has hundreds of millions records.
I believe a more efficient approach is to load transaction hashes from to-be-pruned blocks and delete records by transaction hash which is the **key** of `BlockTransactionLookup` bucket
Contributor guide
Assessment
This issue has not been assessed yet.