TheLaughingManNEAR Old vs NEW
    Updated 2024-10-06
    with base_wallets as (
    SELECT
    TX_SIGNER as wallet,
    MIN(date_trunc('day', block_timestamp)) as min_date
    from near.core.fact_transactions
    WHERE
    block_timestamp >= '2021-11-01' -- Extra Time to store up wallets
    GROUP BY wallet
    ),

    new_txns as (
    SELECT
    COUNT(TX_HASH) as totals,
    TX_SIGNER as wallet,
    date_trunc('day', block_timestamp) as ddate,
    CASE WHEN ddate>min_date THEN 'old' ELSE 'new' END as cat
    from near.core.fact_transactions t
    LEFT JOIN base_wallets b ON t.TX_SIGNER = b.wallet
    WHERE
    block_timestamp >= '2023-01-01'
    GROUP BY ddate, TX_SIGNER, cat
    )

    SELECT
    COUNT(DISTINCT wallet) as total_wallets,
    ddate,
    cat
    from new_txns
    GROUP BY ddate,cat ORDER BY ddate
    QueryRunArchived: QueryRun has been archived