sqldb: drop redundant and unused invoice indexes

Remove four indexes from the invoices table that either duplicate existing
UNIQUE constraint indexes or are never used in WHERE clauses:

- invoices_hash_idx: redundant, UNIQUE constraint on hash already creates
  an implicit index
- invoices_payment_addr_idx: redundant, UNIQUE constraint on payment_addr
  already creates an implicit index
- invoices_preimage_idx: unused, preimage is NULL on all new invoices and
  is never used as a query filter
- invoices_settled_at_idx: unused, settled_at is NULL on all pending
  invoices and is never used as a query filter (settle_index is used
  instead)

Dropping these reduces B-tree working set size, which improves page cache
utilization as the invoice table grows.
This commit is contained in:
ziggie committed 2026-03-04 13:04:26 +01:00
1 parent 2aec8f3380
commit 65f6d75511
3 files changed
+25

No files matched your search

+5
View File
@@ -22,4 +22,9 @@ var migrationAdditions = []MigrationConfig{
// schema. This is optional and can be disabled by the
// user if necessary.
},
{
Name: "000012_drop_redundant_invoice_indexes",
Version: 15,
SchemaVersion: 12,
},
}