mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-28 03:14:26 +01:00
db: Add index covering the output heights
Avoids performing a table scan, now deletes on blocks are a lot faster. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
@@ -215,6 +215,8 @@ char *dbmigrations[] = {
|
||||
* die. */
|
||||
"ALTER TABLE outputs ADD COLUMN confirmation_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;",
|
||||
"ALTER TABLE outputs ADD COLUMN spend_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;",
|
||||
/* Create a covering index that covers both fields */
|
||||
"CREATE INDEX output_height_idx ON outputs (confirmation_height, spend_height);",
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user