adambalaUntitled Query
Updated 2022-12-07
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
›
⌄
with tx as (
select distinct MSG_TYPE , TX_ID as Transactions
from terra.core.fact_msgs
)
,tx_hash as
(select
distinct tx.MSG_TYPE ,
TX_ID ,
BLOCK_TIMESTAMP ,
FEE ,
tx_succeeded
from terra.core.fact_transactions as f inner join tx
on Transactions = f.tx_id
)
select
distinct MSG_TYPE ,
count (distinct TX_ID) as Transaction ,
date_trunc( 'week', BLOCK_TIMESTAMP) as week ,
sum(Transaction) over (partition by MSG_TYPE order by week) as cum_Transactions ,
count (case when tx_succeeded != 'TRUE' then 1 end) as Failed_TX,
count (case when tx_succeeded = 'TRUE' then 1 end) as Success_TX,
(Success_TX / (Success_TX + Failed_TX)) * 100 as Success_Rate,
sum(FEE) as fee ,
avg (fee) as Average_Fee,
median (fee) as Median_Fee,
min (fee) as Minimum_Fee,
max (fee) as Maximum_Fee
from tx_hash
group by 1 ,3
Run a query to Download Data