mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-19 12:01:27 +02:00
sqldb/sqlc: add index on graph_channels(version, id)
This new index greatly improves the speed of the ListChannelsWithPoliciesPaginated query.
This commit is contained in:
@@ -9,6 +9,7 @@ DROP INDEX IF EXISTS graph_channels_node_id_1_idx;
|
||||
DROP INDEX IF EXISTS graph_channels_node_id_2_idx;
|
||||
DROP INDEX IF EXISTS graph_channels_unique;
|
||||
DROP INDEX IF EXISTS graph_channels_version_outpoint_idx;
|
||||
DROP INDEX IF EXISTS graph_channels_version_id_idx;
|
||||
DROP INDEX IF EXISTS graph_channel_features_unique;
|
||||
DROP INDEX IF EXISTS graph_channel_extra_types_unique;
|
||||
DROP INDEX IF EXISTS graph_channel_policies_unique;
|
||||
|
@@ -173,6 +173,7 @@ CREATE TABLE IF NOT EXISTS graph_channels (
|
||||
-- indexes on the node_id_1 and node_id_2 columns.
|
||||
CREATE INDEX IF NOT EXISTS graph_channels_node_id_1_idx ON graph_channels(node_id_1);
|
||||
CREATE INDEX IF NOT EXISTS graph_channels_node_id_2_idx ON graph_channels(node_id_2);
|
||||
CREATE INDEX IF NOT EXISTS graph_channels_version_id_idx ON graph_channels(version, id);
|
||||
|
||||
-- A channel (identified by a short channel id) can only have one active
|
||||
-- channel announcement per protocol version. We also order the index by
|
||||
|
Reference in New Issue
Block a user