mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
Added index to forwarded_payments.state to speedup lookups using this column
This commit is contained in:
parent
8a8f81175d
commit
c1e958d2b9
@ -669,12 +669,13 @@ 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},
|
||||
{SQL("UPDATE channel_htlcs SET malformed_onion = 0 WHERE malformed_onion IS NULL"), NULL},
|
||||
/* Speed up forwarded_payments lookup based on state */
|
||||
{SQL("CREATE INDEX forwarded_payments_state ON forwarded_payments (state)"), NULL},
|
||||
};
|
||||
|
||||
/* Leak tracking. */
|
||||
|
10
wallet/db_postgres_sqlgen.c
generated
10
wallet/db_postgres_sqlgen.c
generated
@ -884,6 +884,12 @@ struct db_query db_postgres_queries[] = {
|
||||
.placeholders = 0,
|
||||
.readonly = false,
|
||||
},
|
||||
{
|
||||
.name = "CREATE INDEX forwarded_payments_state ON forwarded_payments (state)",
|
||||
.query = "CREATE INDEX forwarded_payments_state ON forwarded_payments (state)",
|
||||
.placeholders = 0,
|
||||
.readonly = false,
|
||||
},
|
||||
{
|
||||
.name = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?",
|
||||
.query = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = $1",
|
||||
@ -1786,10 +1792,10 @@ struct db_query db_postgres_queries[] = {
|
||||
},
|
||||
};
|
||||
|
||||
#define DB_POSTGRES_QUERY_COUNT 296
|
||||
#define DB_POSTGRES_QUERY_COUNT 297
|
||||
|
||||
#endif /* HAVE_POSTGRES */
|
||||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
|
||||
|
||||
// SHA256STAMP:4a878278ad7a1d427b80ff3a2abe34ae82cd73cf635ecf25e5cb20532c0604be
|
||||
// SHA256STAMP:bbe38ba26543917c2c8be0eeba93c2d0345b51f7f29803e30cc3f03aaf077798
|
||||
|
10
wallet/db_sqlite3_sqlgen.c
generated
10
wallet/db_sqlite3_sqlgen.c
generated
@ -884,6 +884,12 @@ struct db_query db_sqlite3_queries[] = {
|
||||
.placeholders = 0,
|
||||
.readonly = false,
|
||||
},
|
||||
{
|
||||
.name = "CREATE INDEX forwarded_payments_state ON forwarded_payments (state)",
|
||||
.query = "CREATE INDEX forwarded_payments_state ON forwarded_payments (state)",
|
||||
.placeholders = 0,
|
||||
.readonly = false,
|
||||
},
|
||||
{
|
||||
.name = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?",
|
||||
.query = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?",
|
||||
@ -1786,10 +1792,10 @@ struct db_query db_sqlite3_queries[] = {
|
||||
},
|
||||
};
|
||||
|
||||
#define DB_SQLITE3_QUERY_COUNT 296
|
||||
#define DB_SQLITE3_QUERY_COUNT 297
|
||||
|
||||
#endif /* HAVE_SQLITE3 */
|
||||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
|
||||
|
||||
// SHA256STAMP:4a878278ad7a1d427b80ff3a2abe34ae82cd73cf635ecf25e5cb20532c0604be
|
||||
// SHA256STAMP:bbe38ba26543917c2c8be0eeba93c2d0345b51f7f29803e30cc3f03aaf077798
|
||||
|
42
wallet/statements_gettextgen.po
generated
42
wallet/statements_gettextgen.po
generated
@ -574,75 +574,79 @@ msgstr ""
|
||||
msgid "ALTER TABLE channels ADD funding_tx_remote_sigs_received INTEGER DEFAULT 0;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:675
|
||||
#: wallet/db.c:674
|
||||
msgid "CREATE INDEX forwarded_payments_out_htlc_id ON forwarded_payments (out_htlc_id);"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:677
|
||||
#: wallet/db.c:676
|
||||
msgid "UPDATE channel_htlcs SET malformed_onion = 0 WHERE malformed_onion IS NULL"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:904
|
||||
#: wallet/db.c:678
|
||||
msgid "CREATE INDEX forwarded_payments_state ON forwarded_payments (state)"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:905
|
||||
msgid "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1004
|
||||
#: wallet/db.c:1005
|
||||
msgid "SELECT version FROM version LIMIT 1"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1062
|
||||
#: wallet/db.c:1063
|
||||
msgid "UPDATE version SET version=?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1070
|
||||
#: wallet/db.c:1071
|
||||
msgid "INSERT INTO db_upgrades VALUES (?, ?);"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1082
|
||||
#: wallet/db.c:1083
|
||||
msgid "SELECT intval FROM vars WHERE name = 'data_version'"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1109
|
||||
#: wallet/db.c:1110
|
||||
msgid "SELECT intval FROM vars WHERE name= ? LIMIT 1"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1125
|
||||
#: wallet/db.c:1126
|
||||
msgid "UPDATE vars SET intval=? WHERE name=?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1134
|
||||
#: wallet/db.c:1135
|
||||
msgid "INSERT INTO vars (name, intval) VALUES (?, ?);"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1148
|
||||
#: wallet/db.c:1149
|
||||
msgid "UPDATE channels SET feerate_base = ?, feerate_ppm = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1169
|
||||
#: wallet/db.c:1170
|
||||
msgid "UPDATE channels SET our_funding_satoshi = funding_satoshi WHERE funder = 0;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1185
|
||||
#: wallet/db.c:1186
|
||||
msgid "SELECT type, keyindex, prev_out_tx, prev_out_index, channel_id, peer_id, commitment_point FROM outputs WHERE scriptpubkey IS NULL;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1247
|
||||
#: wallet/db.c:1248
|
||||
msgid "UPDATE outputs SET scriptpubkey = ? WHERE prev_out_tx = ? AND prev_out_index = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1272
|
||||
#: wallet/db.c:1273
|
||||
msgid "SELECT id, funding_tx_id, funding_tx_outnum FROM channels;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1291
|
||||
#: wallet/db.c:1292
|
||||
msgid "UPDATE channels SET full_channel_id = ? WHERE id = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1314
|
||||
#: wallet/db.c:1315
|
||||
msgid "SELECT c.id, p.node_id, c.last_tx, c.funding_satoshi, c.fundingkey_remote, c.last_sig FROM channels c LEFT OUTER JOIN peers p ON p.id = c.peer_id;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/db.c:1381
|
||||
#: wallet/db.c:1382
|
||||
msgid "UPDATE channels SET last_tx = ? WHERE id = ?;"
|
||||
msgstr ""
|
||||
|
||||
@ -1181,4 +1185,4 @@ msgstr ""
|
||||
#: wallet/test/run-wallet.c:1399
|
||||
msgid "INSERT INTO channels (id) VALUES (1);"
|
||||
msgstr ""
|
||||
# SHA256STAMP:e50580171fbee6db0aa824ddc75693d353453c74f4d65c8ca4daf023d7858dc1
|
||||
# SHA256STAMP:9cbdc346b00eec65089e37237361242a6c3afa2c50d2e4ae0210060a08f1a738
|
||||
|
Loading…
Reference in New Issue
Block a user