Skip to content

Remove redundant indexes that duplicate primary keys#1900

Open
AkramBitar wants to merge 1 commit into
mainfrom
remove_redundant_indexes
Open

Remove redundant indexes that duplicate primary keys#1900
AkramBitar wants to merge 1 commit into
mainfrom
remove_redundant_indexes

Conversation

@AkramBitar

@AkramBitar AkramBitar commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #1891 (indexing work for #1873).

Removes six indexes that duplicated — or were a leading prefix of — their table's PRIMARY KEY. A non-unique index that is an exact prefix of the PK's btree provides no read benefit (the PK index already serves those prefix lookups on both PostgreSQL and SQLite), but every one of them is maintained on each INSERT/UPDATE. Dropping them is a pure write-path win.

File Index removed Duplicates
identity.go idx_ic_id_type PRIMARY KEY(id, type, url) (exact)
identity.go idx_audits PRIMARY KEY(identity_hash) (exact)
identity.go idx_signers PRIMARY KEY(identity_hash) (exact)
wallet.go idx_identity_hash_and_wallet_and_role PRIMARY KEY(identity_hash, wallet_id, role_id) (exact)
wallet.go idx_identity_hash leading prefix of the same PK
tokens.go idx_tx_id leading prefix of PRIMARY KEY(tx_id, idx)

@AkramBitar AkramBitar added this to the Q3/26 milestone Jul 13, 2026
@AkramBitar AkramBitar self-assigned this Jul 13, 2026
@AkramBitar AkramBitar force-pushed the remove_redundant_indexes branch 4 times, most recently from 11a832d to c2e8611 Compare July 13, 2026 14:02
Signed-off-by: AkramBitar <akram@il.ibm.com>
@adecaro adecaro force-pushed the remove_redundant_indexes branch from c2e8611 to e4947a8 Compare July 14, 2026 03:59
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.

1 participant