MufasaCount of days to participate in governance stats
    Updated 2023-01-24
    with final_data as (
    select
    -- count_of_days,
    avg(count_of_days) as avg_count_of_days,
    median(count_of_days) as med_count_of_days,
    max(count_of_days) as max_count_of_days
    from (
    select
    voter,
    datediff('day', txns_minimum, votes_minimum) as count_of_days
    from (select
    voter,
    min(block_timestamp) as votes_minimum
    from terra.core.fact_governance_votes votes join
    ( select
    tx_sender,
    min(block_timestamp) as txns_minimum
    from terra.core.fact_transactions
    group by tx_sender) txns
    on votes.voter = txns.tx_sender
    group by voter) vote join (select
    tx_sender,
    min(block_timestamp) as txns_minimum
    from terra.core.fact_transactions
    group by tx_sender) txn on vote.voter = txn.tx_sender
    )
    -- group by count_of_days
    )
    select * from final_data
    Run a query to Download Data