subiniumpolygon new user
    Updated 2024-05-24
    with first_time as (
    SELECT
    FROM_ADDRESS,
    MIN(block_timestamp) as first_time
    FROM optimism.core.fact_transactions
    GROUP BY 1
    ),
    new_user as (
    SELECT
    date_trunc('month', first_time) as month,
    COUNT(FROM_ADDRESS) as new
    FROM first_time
    GROUP BY 1
    ),
    total_user as (
    SELECT
    date_trunc('month', block_timestamp) as month,
    COUNT(distinct FROM_ADDRESS) as mau
    FROM optimism.core.fact_transactions
    GROUP BY 1)

    SELECT
    month,
    mau,
    new,
    sum(new) over(order by month asc) as total_address,
    mau-new as old
    FROM total_user t
    LEFT JOIN new_user n using(month)




    QueryRunArchived: QueryRun has been archived