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.
31 lines
692 B
Go
31 lines
692 B
Go
//go:build test_db_postgres || test_db_sqlite || test_native_sql
|
|
|
|
package sqldb
|
|
|
|
var migrationAdditions = []MigrationConfig{
|
|
{
|
|
Name: "000010_payments",
|
|
Version: 12,
|
|
SchemaVersion: 10,
|
|
},
|
|
{
|
|
Name: "000011_payment_duplicates",
|
|
Version: 13,
|
|
SchemaVersion: 11,
|
|
},
|
|
{
|
|
Name: "kv_payments_migration",
|
|
Version: 14,
|
|
SchemaVersion: 11,
|
|
// A migration function may be attached to this
|
|
// migration to migrate KV payments to the native SQL
|
|
// schema. This is optional and can be disabled by the
|
|
// user if necessary.
|
|
},
|
|
{
|
|
Name: "000012_drop_redundant_invoice_indexes",
|
|
Version: 15,
|
|
SchemaVersion: 12,
|
|
},
|
|
}
|