Afonso_Diazgas fee trends
Updated 2025-02-24
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
›
⌄
WITH main AS (
SELECT
tx_hash,
block_timestamp,
tx_fee
FROM kaia.core.fact_transactions
),
daily_fees AS (
SELECT
DATE_TRUNC('month', block_timestamp) AS tx_day,
COUNT(tx_hash) AS total_tx,
SUM(tx_fee) AS total_fees,
AVG(tx_fee) AS avg_fee_per_tx
FROM main
GROUP BY tx_day
),
fee_trends AS (
SELECT
tx_day,
total_tx,
total_fees,
avg_fee_per_tx,
LAG(avg_fee_per_tx) OVER (ORDER BY tx_day) AS prev_avg_fee,
(avg_fee_per_tx - LAG(avg_fee_per_tx) OVER (ORDER BY tx_day)) / NULLIF(LAG(avg_fee_per_tx) OVER (ORDER BY tx_day), 0) * 100 AS fee_change_pct
FROM daily_fees
)
SELECT
tx_day,
total_tx,
total_fees,
avg_fee_per_tx,
fee_change_pct
FROM fee_trends
ORDER BY tx_day
QueryRunArchived: QueryRun has been archived