mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-07 14:00:08 +02:00
sqldb: add index on node & chan policy last_update columns
So that we can have efficient lookups during the "*UpdatesInHorizon" calls.
This commit is contained in:
@ -3,6 +3,7 @@ DROP INDEX IF EXISTS nodes_unique;
|
||||
DROP INDEX IF EXISTS node_extra_types_unique;
|
||||
DROP INDEX IF EXISTS node_features_unique;
|
||||
DROP INDEX IF EXISTS node_addresses_unique;
|
||||
DROP INDEX IF EXISTS node_last_update_idx;
|
||||
DROP INDEX IF EXISTS source_nodes_unique;
|
||||
DROP INDEX IF EXISTS channels_node_id_1_idx;
|
||||
DROP INDEX IF EXISTS channels_node_id_2_idx;
|
||||
@ -12,6 +13,7 @@ DROP INDEX IF EXISTS channel_features_unique;
|
||||
DROP INDEX IF EXISTS channel_extra_types_unique;
|
||||
DROP INDEX IF EXISTS channel_policies_unique;
|
||||
DROP INDEX IF EXISTS channel_policy_extra_types_unique;
|
||||
DROP INDEX IF EXISTS channel_policy_last_update_idx;
|
||||
|
||||
-- Drop tables in order of reverse dependencies.
|
||||
DROP TABLE IF EXISTS channel_policy_extra_types;
|
||||
|
@ -37,6 +37,7 @@ CREATE TABLE IF NOT EXISTS nodes (
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS nodes_unique ON nodes (
|
||||
pub_key, version
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS node_last_update_idx ON nodes(last_update);
|
||||
|
||||
-- node_extra_types stores any extra TLV fields covered by a node announcement that
|
||||
-- we do not have an explicit column for in the nodes table.
|
||||
@ -273,6 +274,7 @@ CREATE TABLE IF NOT EXISTS channel_policies (
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS channel_policies_unique ON channel_policies (
|
||||
channel_id, node_id, version
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS channel_policy_last_update_idx ON channel_policies(last_update);
|
||||
|
||||
-- channel_policy_extra_types stores any extra TLV fields covered by a channel
|
||||
-- update that we do not have an explicit column for in the channel_policies
|
||||
|
Reference in New Issue
Block a user