Query editor
withL as (select * from dune.fadz2323.result_base_liq_open_race_events where t < timestamp '2026-12-04'),S as (select * from dune.fadz2323.result_base_liq_open_race_svr),X as (select * from dune.fadz2323.result_base_liq_open_race_txs),tb as (select tx, sum(bonus_usd) tx_bonus from L group by 1),e as (select L.*, X.tx_type, X.prio_usd / nullif(tb.tx_bonus,0) prio_pct, S.lag_fb_mapped, S.lag_fb_any, S.svr_agg,L.ts - S.last_atlas_ts gap_atlas,casewhen (S.last_atlas_ts is not null and L.ts - S.last_atlas_ts <= 10) or (S.last_s_ts is not null and L.ts - S.last_s_ts <= 10) then 'leftover'when S.lag_fb_mapped is not null or (S.svr_agg is null and S.lag_fb_any <= 3) then 'fallback'when S.nonsvr_hit >= 0 then 'non_svr'else 'drift' end cls,case when L.b >= 53664122 then 'post_200ms' else 'pre_200ms' end erafrom L join S on S.tx = L.tx and S.ei = L.eileft join X on X.tx = L.tx left join tb on tb.tx = L.txwhere not L.is_atlas)select cls, era, count(*) n, round(sum(bonus_usd)) bonus, count(distinct winner) winners,round(approx_percentile(prio_pct, 0.25),3) p25_prio, round(approx_percentile(prio_pct, 0.5),3) p50_prio, round(approx_percentile(prio_pct, 0.75),3) p75_prio,round(sum(case when bonus_usd >= 100 then prio_pct * bonus_usd end)/sum(case when bonus_usd >= 100 then bonus_usd end),3) wavg_prio_ge100,approx_percentile(txi, 0.5) med_txi,round(approx_percentile(coalesce(lag_fb_mapped, lag_fb_any), 0.5),2) med_fb_lag_s,round(approx_percentile(gap_atlas, 0.5),2) med_gap_atlas_s,map_agg(tx_type_k, tx_type_n) tx_typesfrom eleft join (select cls cls2, era era2, coalesce(tx_type,'?') tx_type_k, count(*) tx_type_n from e group by 1,2,3) tton falsegroup by 1,2order by 1,2