Skip to content

Commit

Permalink
fix(dashboard): improve withdrawal query performance
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbitfly committed Dec 17, 2024
1 parent 2010d66 commit 35ff099
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/pkg/api/data_access/vdb_withdrawals.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ func (d *DataAccessService) GetValidatorDashboardWithdrawals(ctx context.Context
// Limit the query to relevant validators
queryParams = append(queryParams, pq.Array(validators))
whereQuery := fmt.Sprintf(`
WHERE
validatorindex = ANY ($%d)`, len(queryParams))
WHERE EXISTS (
SELECT 1
FROM blocks_withdrawals
WHERE validatorindex = ANY ($%d)
) AND validatorindex = ANY ($%d)`, len(queryParams), len(queryParams))

// Limit the query using sorting and the cursor
orderQuery := ""
Expand Down

0 comments on commit 35ff099

Please sign in to comment.