Skip to content

refactor(store/db): declare block_headers as WITHOUT ROWID#2238

Merged
kkovaacs merged 3 commits into
nextfrom
krisztian/sqlite-block-headers-without-rowid
Jun 11, 2026
Merged

refactor(store/db): declare block_headers as WITHOUT ROWID#2238
kkovaacs merged 3 commits into
nextfrom
krisztian/sqlite-block-headers-without-rowid

Conversation

@kkovaacs

@kkovaacs kkovaacs commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR converts block_headers to a WITHOUT ROWID table.

Current key is BIGINT PRIMARY KEY, which in SQLite is not the special rowid alias. It therefore stores a hidden rowid plus a unique index on block_num. All current access is by block_num, latest ORDER BY block_num DESC LIMIT 1, IN, or full ordered scan.

Changelog

[[entry]]
scope       = "node"
impact      = "migration"
description = "The block_headers table was converted to a WITHOUT ROWID table"

kkovaacs added 2 commits June 10, 2026 14:57
Remove unused indexes, redundant indexes and redundant columns from indexes.
Current key is BIGINT PRIMARY KEY, which in SQLite is not the special
rowid alias. It therefore stores a hidden rowid plus a unique index on
block_num. All current access is by block_num, latest ORDER BY block_num
DESC LIMIT 1, IN, or full ordered scan.
@kkovaacs kkovaacs marked this pull request as ready for review June 10, 2026 14:45
Base automatically changed from krisztian/sqlite-optimize-indexes to next June 11, 2026 06:22
@kkovaacs kkovaacs enabled auto-merge (squash) June 11, 2026 14:02
@kkovaacs kkovaacs merged commit 867213c into next Jun 11, 2026
24 checks passed
@kkovaacs kkovaacs deleted the krisztian/sqlite-block-headers-without-rowid branch June 11, 2026 14:04
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