Query editor
-- Collector Crypt: Daily gacha participants, New vs Recurring-- Forked/rebuilt from reference query 5476561.---- "New" = first day this wallet ever sent USDC to a gacha wallet-- "Recurring" = wallet has purchased before and is buying again---- Cost optimization: combined two separate full scans of tokens_solana.transfers-- (first_entry + daily_activity) into a single scan, using MIN(day) OVER-- (PARTITION BY wallet) on the already-scanned distinct day/wallet pairs-- instead of a second independent scan to find each wallet's first day.---- Note: intentionally NOT date-bounded -- classification depends on each-- wallet's true first-ever purchase across all history, so bounding the-- scan would misclassify long-time returning wallets as "new" whenever-- they first reappear inside the window.WITH activity AS (SELECT DISTINCTDATE(a.block_time) AS day,a.from_owner AS walletFROM tokens_solana.transfers aWHERE a.to_owner IN ('GachazZscHZ5bn3vnq1yEC4zpYdhAYJBzuKJwSJksc9z','GachaNgyXTU3zFogQ8Z5jR2BLXs8215X2AtEH18VxJq3')AND a.token_mint_address = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'),classified AS (SELECTday,wallet,CASE WHEN day = MIN(day) OVER (PARTITION BY wallet) THEN 'new' ELSE 'recurring' END AS user_typeFROM activity)SELECTday,COUNT(CASE WHEN user_type = 'recurring' THEN 1 END) AS recurring_users,COUNT(CASE WHEN user_type = 'new' THEN 1 END) AS new_usersFROM classifiedGROUP BY dayORDER BY day ASC