mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-10 23:12:44 +02:00
graph/db+sqldb: queries and logic for batch fetching node data
In this commit, we add the queries that will be needed to batch-fetch the data of a set of nodes. The logic for using these new queries is also added but not used yet.
This commit is contained in:
@@ -114,6 +114,12 @@ FROM graph_nodes n
|
||||
WHERE n.pub_key = $1
|
||||
AND n.version = $2;
|
||||
|
||||
-- name: GetNodeFeaturesBatch :many
|
||||
SELECT node_id, feature_bit
|
||||
FROM graph_node_features
|
||||
WHERE node_id IN (sqlc.slice('ids')/*SLICE:ids*/)
|
||||
ORDER BY node_id, feature_bit;
|
||||
|
||||
-- name: DeleteNodeFeature :exec
|
||||
DELETE FROM graph_node_features
|
||||
WHERE node_id = $1
|
||||
@@ -140,6 +146,12 @@ FROM graph_node_addresses
|
||||
WHERE node_id = $1
|
||||
ORDER BY type ASC, position ASC;
|
||||
|
||||
-- name: GetNodeAddressesBatch :many
|
||||
SELECT node_id, type, position, address
|
||||
FROM graph_node_addresses
|
||||
WHERE node_id IN (sqlc.slice('ids')/*SLICE:ids*/)
|
||||
ORDER BY node_id, type, position;
|
||||
|
||||
-- name: GetNodesByLastUpdateRange :many
|
||||
SELECT *
|
||||
FROM graph_nodes
|
||||
@@ -170,6 +182,12 @@ SELECT *
|
||||
FROM graph_node_extra_types
|
||||
WHERE node_id = $1;
|
||||
|
||||
-- name: GetNodeExtraTypesBatch :many
|
||||
SELECT node_id, type, value
|
||||
FROM graph_node_extra_types
|
||||
WHERE node_id IN (sqlc.slice('ids')/*SLICE:ids*/)
|
||||
ORDER BY node_id, type;
|
||||
|
||||
-- name: DeleteExtraNodeType :exec
|
||||
DELETE FROM graph_node_extra_types
|
||||
WHERE node_id = $1
|
||||
|
Reference in New Issue
Block a user