rezarwzCompare Block Performance - Avg, Min, Max
    Updated 2022-07-27
    select
    avg(abs(period)) as average_sec, --its per seconds
    max(abs(period)) as max_sec,
    min(abs(period)) as min_sec,
    BLOCKCHAIN
    from (
    SELECT
    distinct BLOCK_NUMBER,
    BLOCKCHAIN,
    block_timestamp,
    LAG(block_timestamp) IGNORE NULLS OVER (ORDER BY BLOCK_NUMBER) as last_block_timestamp,
    datediff(SECOND,block_timestamp,last_block_timestamp) as period
    from polygon.core.fact_blocks
    order by block_timestamp asc
    )
    group by BLOCKCHAIN
    UNION
    select
    avg(abs(period)) as average_sec, --its per seconds
    max(abs(period)) as max_sec,
    min(abs(period)) as min_sec,
    BLOCKCHAIN
    from (
    SELECT
    distinct BLOCK_ID,
    CHAIN_ID as BLOCKCHAIN,
    block_timestamp,
    LAG(block_timestamp) IGNORE NULLS OVER (ORDER BY BLOCK_ID) as last_block_timestamp,
    datediff(SECOND,block_timestamp,last_block_timestamp) as period
    from solana.core.fact_blocks
    order by block_timestamp asc
    )
    group by BLOCKCHAIN
    UNION
    select
    avg(abs(period)) as average_sec, --its per seconds
    Run a query to Download Data