granadohoMaximum Time Between Blocks
    Updated 2022-01-20
    WITH table1 as (
    select
    t1.block_id as block_id,
    LAG(t1.timestamp, 1) OVER(ORDER BY block_id) AS start_time,
    t1.timestamp as end_time,
    TIMESTAMPDIFF(SECOND, LAG(t1.timestamp, 1) OVER(ORDER BY block_id), t1.timestamp) AS SECONDDIFFERENCE
    from (
    SELECT
    block_id ,max(block_timestamp) AS timestamp
    FROM algorand.block
    GROUP BY block_id
    ORDER BY timestamp ASC
    ) t1
    )

    SELECT
    table1.block_id as block_id, table1.end_time as datetime,
    table1.SECONDDIFFERENCE as maximum_time_between_blocks
    from table1
    where maximum_time_between_blocks = (select max(table1.SECONDDIFFERENCE) from table1)
    Run a query to Download Data