Salehp-v-p-compare all
    Updated 2022-07-23
    with lst_all_polygon as (
    select
    BLOCK_NUMBER
    ,lag(BLOCK_TIMESTAMP,1) over( order by BLOCK_TIMESTAMP) as date_lag
    ,datediff(second,date_lag,BLOCK_TIMESTAMP) as date_diff_block
    from polygon.core.fact_blocks
    )
    ,dist_poly as (
    select
    case
    when DATE_DIFF_BLOCK >=0 and DATE_DIFF_BLOCK<=3 then '0 Sec To 3 Sec'
    when DATE_DIFF_BLOCK >3 and DATE_DIFF_BLOCK<=5 then '4 Sec To 5 Sec'
    when DATE_DIFF_BLOCK >5 and DATE_DIFF_BLOCK<=10 then '6 Sec To 10 Sec'
    when DATE_DIFF_BLOCK >10 and DATE_DIFF_BLOCK<=30 then '11 Sec To 30 Sec'
    when DATE_DIFF_BLOCK >30 then 'More than 31 seconds'
    end as Distribution
    ,count(DATE_DIFF_BLOCK) as block_counts
    from lst_all_polygon
    where DATE_DIFF_BLOCK>0
    group by 1
    order by 1
    )
    , lst_all_sol as (
    select
    BLOCK_ID
    ,lag(BLOCK_TIMESTAMP,1) over( order by BLOCK_TIMESTAMP) as date_lag
    ,datediff(second,date_lag,BLOCK_TIMESTAMP) as date_diff_block
    from solana.core.fact_blocks
    )
    ,dist_sol as (
    select
    case
    when DATE_DIFF_BLOCK >=0 and DATE_DIFF_BLOCK<=3 then '0 Sec To 3 Sec'
    when DATE_DIFF_BLOCK >3 and DATE_DIFF_BLOCK<=5 then '4 Sec To 5 Sec'
    when DATE_DIFF_BLOCK >5 and DATE_DIFF_BLOCK<=10 then '6 Sec To 10 Sec'
    when DATE_DIFF_BLOCK >10 and DATE_DIFF_BLOCK<=30 then '11 Sec To 30 Sec'
    Run a query to Download Data