Skip to content

Commit

Permalink
feat(governance): optimize UTxO subquery using consumed_by_tx
Browse files Browse the repository at this point in the history
  • Loading branch information
sorki committed Nov 4, 2024
1 parent 30ec8cf commit b604dc5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/sql/governance/dreps_drep_id_delegators.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ SELECT "address" AS "address",
(
SELECT COALESCE(SUM(txo.value), 0)
FROM tx_out txo
LEFT JOIN tx_in txi ON (txo.tx_id = txi.tx_out_id)
AND (txo.index = txi.tx_out_index)
WHERE txi IS NULL
WHERE txo.consumed_by_tx_id IS NULL
AND txo.stake_address_id = address_id
) + (
SELECT COALESCE(SUM(amount), 0)
Expand Down

0 comments on commit b604dc5

Please sign in to comment.