Skip to content

Slow responses for utxos_aggregate by address #940

@Kartiiyer12

Description

@Kartiiyer12

What
utxos_aggregate for address takes more than one minute for addresses. This is mostly because of the missing on the tx_out table for address column.

Query -

{
  utxos_aggregate(where: {address: {_eq: "addr1qyp37p9528a6wffjxaplmcmtv6huyhg3tny44vr6kuv9hjgrruztg50m5ujnyd6rlh3kke40cfw3zhxft2c84dcct0ysfkfqgg"}}) {
aggregate {
sum {
value
}}
}}

Solution
Create the following index -
CREATE INDEX IF NOT EXISTS idx_tx_out_address ON tx_out USING hash (address);

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions