i_danKaia Chain: Transactions And Average TPS
    Updated 2025-02-26
    -- Parts of this query are forked and inspired from https://flipsidecrypto.xyz/optimus_prime/aptos-built-for-a-billion-people-rEKoh9 By Optimus_Prime

    SELECT
    -- All time calculations
    COUNT(DISTINCT tx_hash) AS total_transactions
    , DATEDIFF('second'
    , MIN(block_timestamp)
    , MAX(block_timestamp)) AS total_seconds
    , COUNT(DISTINCT tx_hash) / NULLIF(DATEDIFF('second'
    , MIN(block_timestamp)
    , MAX(block_timestamp))
    , 0) AS avg_all_time_tps
    -- Last 90 days calculations
    , COUNT(CASE
    WHEN block_timestamp >= CURRENT_DATE - INTERVAL '90 days'
    THEN 1 END) AS last_90_days_transactions
    , DATEDIFF('second'
    , MIN(CASE
    WHEN block_timestamp >= CURRENT_DATE - INTERVAL '90 days'
    THEN block_timestamp END)
    , MAX(block_timestamp)) AS last_90_days_seconds
    , COUNT(CASE
    WHEN block_timestamp >= CURRENT_DATE - INTERVAL '90 days'
    THEN 1 END) / NULLIF(DATEDIFF('second'
    , MIN(CASE
    WHEN block_timestamp >= CURRENT_DATE - INTERVAL '90 days'
    THEN block_timestamp END)
    , MAX(block_timestamp))
    , 0) AS avg_last_90_days_tps

    -- Last 30 days calculations
    , COUNT(CASE
    WHEN block_timestamp >= CURRENT_DATE - INTERVAL '30 days'
    THEN 1 END) AS last_30_days_transactions
    , DATEDIFF('second'
    Last run: about 1 month ago
    TOTAL_TRANSACTIONS
    TOTAL_SECONDS
    AVG_ALL_TIME_TPS
    LAST_90_DAYS_TRANSACTIONS
    LAST_90_DAYS_SECONDS
    AVG_LAST_90_DAYS_TPS
    LAST_30_DAYS_TRANSACTIONS
    LAST_30_DAYS_SECONDS
    AVG_LAST_30_DAYS_TPS
    LAST_7_DAYS_TRANSACTIONS
    LAST_7_DAYS_SECONDS
    AVG_LAST_7_DAYS_TPS
    1
    8116916567596925310.6844765639588777996537.23056427741715261565310.60603850879386284538.095972
    1
    109B
    72s