sallarPolygon Block Performance, average length of blocks polygun, flow and solana
    Updated 2022-07-26
    with initial_data_one as
    (
    select
    block_number,
    block_timestamp,
    tx_count,
    LAG(block_timestamp,1) OVER (ORDER BY block_timestamp) previous_block_timestamp,
    DATEDIFF(second, previous_block_timestamp, block_timestamp) as previous_block_length
    from polygon.core.fact_blocks
    ),
    initial_data_two as
    (
    select
    'PolyGon' as status,
    avg(previous_block_length) as average_block_length_in_seconds,
    avg(tx_count) as average_number_of_transactions_per_block,
    sum(tx_count) as total_number_of_transactions_per_block,
    count(distinct block_number) as number_of_blocks,
    max(previous_block_length) as largest_block_length_in_seconds,
    min(previous_block_length) as smallest_block_length_in_seconds,
    max(tx_count) as largest_number_of_transactions,
    min(tx_count) as smallest_number_of_transactions
    from initial_data_one
    ),
    initial_data_three as
    (
    select
    block_height as block_number,
    block_timestamp,
    tx_count,
    LAG(block_timestamp,1) OVER (ORDER BY block_timestamp) previous_block_timestamp,
    DATEDIFF(second, previous_block_timestamp, block_timestamp) as previous_block_length
    from flow.core.fact_blocks
    where block_timestamp >= '2022-06-06 15:14:51.000'
    ),
    initial_data_four as
    Run a query to Download Data