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.
5 lines
292 B
SQL
5 lines
292 B
SQL
CREATE INDEX IF NOT EXISTS invoices_hash_idx ON invoices(hash);
|
|
CREATE INDEX IF NOT EXISTS invoices_payment_addr_idx ON invoices(payment_addr);
|
|
CREATE INDEX IF NOT EXISTS invoices_preimage_idx ON invoices(preimage);
|
|
CREATE INDEX IF NOT EXISTS invoices_settled_at_idx ON invoices(settled_at);
|