adriaparcerisasNear report 3
    Updated 2024-12-09
    with
    hourly as (
    Select
    trunc(block_timestamp,'hour') as date,
    count(distinct tx_hash) as txs,
    sum(txs) over (order by date) as cum_txs
    From near.core.fact_transactions
    Where block_timestamp::date >=current_date - INTERVAL '1 WEEK'
    Group by 1
    order by 1 ASC
    ),
    daily as (
    Select
    trunc(block_timestamp,'day') as date,
    count(distinct tx_hash) as txs,
    sum(txs) over (order by date) as cum_txs
    From near.core.fact_transactions
    Where block_timestamp::date >=current_date - INTERVAL '1 MONTH'
    Group by 1
    order by 1 ASC
    ),
    weekly as (
    Select
    trunc(block_timestamp,'week') as date,
    count(distinct tx_hash) as txs,
    sum(txs) over (order by date) as cum_txs
    From near.core.fact_transactions
    Where block_timestamp::date >=current_date - INTERVAL '3 MONTHS'
    Group by 1
    order by 1 ASC
    )
    select * from {{granularity}} where date <trunc(current_date,'hour') order by 1 asc

    --select distinct tx_signer, count(*) as counts from near.core.fact_transactions where block_timestamp>=current_date-3 and tx_hash='4t6QWz8vS6YGpLMCKfmDMn4d7ubD4h6yZEMhji3frGzz'
    --select distinct tx_signer, count(*) as counts from near.core.fact_transactions where block_timestamp>=current_date-7 and tx_signer ilike '%here.tg%' group by 1 order by 2 desc limit 100
    QueryRunArchived: QueryRun has been archived