mirektheprinterPolygon Block Performance
    Updated 2022-07-27
    WITH SOL AS (
    SELECT avg(datediff(second , b1.block_timestamp::timestamp , b2.block_timestamp::timestamp)) as avg_time,
    min(datediff(second , b1.block_timestamp::timestamp , b2.block_timestamp::timestamp)) as min_time,
    max(datediff(second , b1.block_timestamp::timestamp , b2.block_timestamp::timestamp)) as max_time,
    avg(b1.tx_count) as avg_tx_count,
    'Solana' as network
    From solana.core.fact_blocks b1 ,solana.core.fact_blocks b2
    WHERE b2.previous_block_id = b1.block_id and
    b1.block_timestamp <= CURRENT_DATE - 30 and
    b2.block_timestamp <= CURRENT_DATE - 30 and
    b2.block_timestamp > b1.block_timestamp
    ),
    POLY AS (
    SELECT avg(datediff(second , p1.block_timestamp::timestamp , p2.block_timestamp::timestamp)) as avg_time,
    min(datediff(second , p1.block_timestamp::timestamp , p2.block_timestamp::timestamp)) as min_time,
    max(datediff(second , p1.block_timestamp::timestamp , p2.block_timestamp::timestamp)) as max_time,
    avg(p1.tx_count) as avg_tx_count,
    'Polygon' as network
    From polygon.core.fact_blocks p1 ,polygon.core.fact_blocks p2
    WHERE p2.block_number-1 = p1.block_number and
    p1.block_timestamp <= CURRENT_DATE - 30 and
    p2.block_timestamp <= CURRENT_DATE - 30 and
    p2.block_timestamp > p1.block_timestamp
    ),
    ETH AS (
    SELECT avg(datediff(second , e1.block_timestamp::timestamp , e2.block_timestamp::timestamp)) as avg_time,
    min(datediff(second , e1.block_timestamp::timestamp , e2.block_timestamp::timestamp)) as min_time,
    max(datediff(second , e1.block_timestamp::timestamp , e2.block_timestamp::timestamp)) as max_time,
    avg(e1.tx_count) as avg_tx_count,
    'Ethereum' as network
    From ethereum.core.fact_blocks e1 ,ethereum.core.fact_blocks e2
    WHERE e2.block_number-1 = e1.block_number and
    e1.block_timestamp <= CURRENT_DATE - 30 and
    e2.block_timestamp <= CURRENT_DATE - 30 and
    e2.block_timestamp > e1.block_timestamp
    ),
    Run a query to Download Data