Skip to content

Commit

Permalink
wallet/db.c: Speed up deletion of single peers.
Browse files Browse the repository at this point in the history
ChangeLog-Fixed: Database: Speed up deletion of peer especially when there is a long history with that peer.
  • Loading branch information
ZmnSCPxj committed Jan 18, 2021
1 parent 6f924e6 commit acafc0f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 17 deletions.
5 changes: 5 additions & 0 deletions wallet/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,11 @@ static struct migration dbmigrations[] = {
/* A reference into our own offers table, if it was made from one */
{SQL("ALTER TABLE payments ADD COLUMN local_offer_id BLOB DEFAULT NULL REFERENCES offers(offer_id);"), NULL},
{SQL("ALTER TABLE channels ADD funding_tx_remote_sigs_received INTEGER DEFAULT 0;"), NULL},

/* Speeds up deletion of one peer from the database, measurements suggest
* it cuts down the time by 80%. */
{SQL("CREATE INDEX forwarded_payments_out_htlc_id"
" ON forwarded_payments (out_htlc_id);"), NULL},
};

/* Leak tracking. */
Expand Down
6 changes: 6 additions & 0 deletions wallet/db_postgres_sqlgen.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions wallet/db_sqlite3_sqlgen.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 21 additions & 17 deletions wallet/statements_gettextgen.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit acafc0f

Please sign in to comment.