mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-01 08:29:00 +01:00
graph/db+sqldb: use batch validation for node migration
Restructue the `migrateNodes` function so that it does the validation of migrated nodes in batches. So instead of fetching each node individually after migrating it, we wait for a minimum batch size to be reached and then validate a batch of nodes together. This lets us make way fewer DB round trips.
This commit is contained in:
@@ -21,6 +21,11 @@ WHERE graph_nodes.last_update IS NULL
|
||||
OR EXCLUDED.last_update > graph_nodes.last_update
|
||||
RETURNING id;
|
||||
|
||||
-- name: GetNodesByIDs :many
|
||||
SELECT *
|
||||
FROM graph_nodes
|
||||
WHERE id IN (sqlc.slice('ids')/*SLICE:ids*/);
|
||||
|
||||
-- name: GetNodeByPubKey :one
|
||||
SELECT *
|
||||
FROM graph_nodes
|
||||
|
||||
Reference in New Issue
Block a user