Browse Source

db: Add index on utxoset.spendheight to speed up blockchain reorgs

Otherwise we would be doing a table scan per block being reorged/rescanned.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
parent
commit
50a8e32e3f
  1. 3
      wallet/db.c

3
wallet/db.c

@ -227,6 +227,9 @@ char *dbmigrations[] = {
" satoshis BIGINT,"
" PRIMARY KEY(txid, outnum));",
"CREATE INDEX short_channel_id ON utxoset (blockheight, txindex, outnum)",
/* Necessary index for long rollbacks of the blockchain, otherwise we're
* doing table scans for every block removed. */
"CREATE INDEX utxoset_spend ON utxoset (spendheight)",
NULL,
};

Loading…
Cancel
Save