Eman-RazDistribution of Users By Average Time between Transactions
    Updated 2025-03-05
    with tab1 as (select signers[0] as user, block_timestamp as txs_date,
    lag(block_timestamp) over (partition by user order by block_timestamp) as Previous_transaction_date
    from eclipse.core.fact_transactions
    where succeeded='TRUE'),
    tab2 as (select user, avg(datediff(hour,Previous_transaction_date, txs_date)) as avg_time_gap
    from tab1
    where Previous_transaction_date is not null
    group by user
    order by user)

    select case
    when avg_time_gap<=12 then 'TG<=12 Hours'
    when avg_time_gap>12 and avg_time_gap<=24 then '12Hours< TG <=1Day'
    when avg_time_gap>24 and avg_time_gap<=72 then '1Day< TG <=3Days'
    when avg_time_gap>72 and avg_time_gap<=168 then '3Day< TG <=1Week'
    when avg_time_gap>168 and avg_time_gap<=720 then '1Week< TG <=1Month'
    else 'TG>1 Month' end as "Avg Time Between TXs", count(distinct user) as "User Count"
    from tab2
    group by 1
    order by 1

    Last run: about 2 months ago
    Avg Time Between TXs
    User Count
    1
    12Hours< TG <=1Day53080
    2
    1Day< TG <=3Days144568
    3
    1Week< TG <=1Month68156
    4
    3Day< TG <=1Week91621
    5
    TG<=12 Hours493995
    6
    TG>1 Month7587
    6
    158B
    855s