BlockTrackeradd gas_used over time
Updated 2023-07-17
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
›
⌄
-- forked from add gas_used @ https://flipsidecrypto.xyz/edit/queries/5942d116-fdcf-452e-907f-b307d6cda3c2
SELECT
platform,
date_trunc('d', a.block_timestamp) as date,
count(DISTINCT a.tx_hash) as n_swaps,
avg(gas_used) as avg.gas_used,
min(gas_used) as min_gas_used,
max(gas_used) as max_gas_used
FROM {{chain}}.core.ez_dex_swaps a
LEFT JOIN {{chain}}.core.fact_transactions b using(tx_hash)
WHERE a.block_timestamp > dateadd('month', -1*{{last_n_months}}, current_date)
AND a.block_timestamp < current_date
GROUP BY 1 , 2
HAVING n_swaps > 10
ORDER BY avg_gas_used
Run a query to Download Data