0xHaM-dDistribution of Users based on Avg Time between Txs
    Updated 2024-10-03
    -- forked from Distribution of Users based on Avg Time between Txs copy @ https://flipsidecrypto.xyz/edit/queries/453e7b8b-9fa7-4964-be49-a7e8d92cc6db

    -- forked from Distribution of Users based on Avg Time between Txs @ https://flipsidecrypto.xyz/edit/queries/2339f5f5-358a-4818-a4e9-83d28d884382

    -- forked from Distribution of Users based on Avg Time between Txs @ https://flipsidecrypto.xyz/edit/queries/7df25dad-571c-4cfd-ac09-53e31da6b77c

    -- forked from Distribution of Users based on Avg Time between Txs @ https://flipsidecrypto.xyz/edit/queries/7df25dad-571c-4cfd-ac09-53e31da6b77c
    with txs as (
    select
    block_timestamp,
    TX_HASH,
    tx_signer
    from near.core.fact_transactions
    )
    ,
    txsGap AS (
    SELECT
    tx_signer as User,
    block_timestamp as Txs_date,
    LAG(block_timestamp) OVER (
    PARTITION BY User
    ORDER BY
    block_timestamp
    ) AS prev_Txs_date
    FROM txs
    ),
    txs_time as (
    SELECT
    User,
    AVG(
    DATEDIFF(hour, prev_Txs_date, Txs_date)
    ) AS avg_txs_gap
    FROM
    txsGap
    WHERE
    prev_Txs_date IS NOT NULL
    QueryRunArchived: QueryRun has been archived