omer93Avalanche principals 6
    Updated 2024-01-10
    WITH
    blocks as (
    select
    block_number,
    min(block_timestamp) as block_debut,
    LAG(block_debut,1) IGNORE NULLS OVER (ORDER BY block_number) as last_block_time
    from avalanche.core.fact_transactions
    where block_timestamp>=current_date-interval '3 months' and status='SUCCESS'
    group by 1
    --order by 1 asc
    ),
    times as (
    SELECT
    block_number,
    block_debut,
    datediff('second',last_block_time,block_debut) as time_between_blocks_in_sec
    from blocks
    )
    SELECT
    trunc(block_debut,'day') as date,
    avg(time_between_blocks_in_sec) as avg_time_per_block_in_sec
    from times where date<current_date
    group by 1
    order by 1 asc


    QueryRunArchived: QueryRun has been archived