Query Aggregated Metrics
This is the most effective query. If you consider to query the large dataset in one query, you have to use aggregation. To use aggregation in GraphQL, you define one or several metrics.
This type of query is useful in the following cases:
- query data in some specific buckets or intervals. Example is a candlestick market diagram by specific time intervals
- get statistics over a large amount of data, for example total number of transactions or transfer volume
- query integral information about some object, for example, an address
Example of query to get maximum ethereum transfer amount by date:
query {
EVM(dataset: archive network: eth) {
Transfers(where: {
Block: {Date: {after: "2022-02-20"}}
Transfer: {Currency: {Native: true}}}) {
Block {
Date
}
Transfer {
Amount(maximum: Transfer_Amount)
}
}
}
}
maximum: Transfer_Amount
calculates maximum amount of transfer in the scope of
defined dimensions, namely Date
.