Queries · q060 · Head of Growth Marketing · week 1, night 4
“How many A/B tests has the platform run, in what state are they, and how often does a test actually end with a declared winner?”
Fictional people at a fictional company, each played by a language-model agent. Who they are and what they are told
The manager, at the start of week 1
Subject: What I need to get oriented this week
Hi Sofie,
Thrilled to be here — here's where my head's at. I know you've only got a handful of report slots a night, so I've ordered these by what I need most. Please push back if any of these are too broad or should split into more than one report.
What I need this for: I'm meeting the leadership team Friday and want a grounded, numbers-based view of growth marketing's current state before I propose anything. No need for polish — I just want to know what's really happening so I don't propose things that are already working, or miss things that are quietly broken.
Thanks for taking this on — let me know if you want me to cut this list down.
Chloé
The analyst · week 1, night 4, request 3 of 3
Last night's industry breakdown overturned my earlier 'discounted orders are healthier' read: that was Simpson's-paradox-driven by B2B contract pricing (huge baskets, 40+ items/order) and near-free subscription trial offers in Food & Coffee/Pet Supplies (avg order value ~6-8 EUR). Within actual consumer retail verticals (apparel, beauty, electronics, home, sports), discounted orders have equal-or-lower AOV and meaningfully HIGHER return rates than full-price ones — the opposite of the pooled story. That's resolved and ready for the memo, no further query needed there. The loyalty report is the one open thread: members show lower order frequency and AOV than non-members, which is counterintuitive, and I suspect the same composition trap (loyalty concentrated in low-AOV subscription verticals) — worth one check before I tell Chloé 'loyalty doesn't move the needle.' Email engagement (29.9% open, 2.4% click, healthy bounce/unsubscribe) looked like a normal, non-alarming baseline with only one channel actually used, so I'm not spending a slot chasing it further. With this being the last night, I'm using the remaining two slots to close out Chloé's still-open questions: the referral half of Q4, and a first look at Q5 (A/B tests), both as compact baseline reports for the Friday memo.
The engineer · 1 dry run on the empty schema, then the submission
SELECT t.status, t.tests_count, ROUND(t.tests_count * 100.0 / (SELECT COUNT(*) FROM ab_tests), 1) AS share_of_tests_pct, t.tests_with_winner_declared_count, ROUND(t.avg_variants_per_test, 1) AS avg_variants_per_test, ROUND(t.avg_duration_days, 1) AS avg_duration_days FROM ( SELECT a.status, COUNT(*) AS tests_count, COUNT(*) FILTER (WHERE a.winner_variant_id IS NOT NULL) AS tests_with_winner_declared_count, AVG(vc.variant_count) AS avg_variants_per_test, AVG(CASE WHEN a.started_at IS NOT NULL AND a.ended_at IS NOT NULL THEN EXTRACT(EPOCH FROM (a.ended_at - a.started_at)) / 86400.0 END) AS avg_duration_days FROM ab_tests a LEFT JOIN ( SELECT ab_test_id, COUNT(*) AS variant_count FROM ab_variants GROUP BY ab_test_id ) vc ON vc.ab_test_id = a.id GROUP BY a.status ) t ORDER BY t.tests_count DESC, t.status ASC
“Query compiles and returns the expected columns. Submitting.”
“Submitted. The report groups ab_tests by status (draft/running/paused/completed/archived) with counts, share of total, winner-declared counts, average linked variants per test, and average duration in days for tests with both start and end timestamps — ordered by test count descending, status ascending as tie-break.”
As Sofie Nilsen saw it, from the small dataset the agents worked on
status | tests_count | share_of_tests_pct | tests_with_winner_declared_count | avg_variants_per_test | avg_duration_days ----------+-------------+--------------------+----------------------------------+-----------------------+------------------ completed | 1036 | 99.6 | 646 | 2.0 | 3.0 running | 4 | 0.4 | 0 | 2.0 | NULL (2 rows)
Changed only where the benchmark needs the same result on every system
SELECT t.status, t.tests_count, ROUND(t.tests_count * 100.0 / (SELECT COUNT(*) FROM ab_tests), 1) AS share_of_tests_pct, t.tests_with_winner_declared_count, ROUND(t.avg_variants_per_test, 1) AS avg_variants_per_test, ROUND(t.avg_duration_days, 1) AS avg_duration_days t.status AS status, t.tests_count AS tests_count, t.tests_count * 100.0 / (SELECT COUNT(*) FROM ab_tests) AS share_of_tests_pct, t.tests_with_winner_declared_count AS tests_with_winner_declared_count, t.avg_variants_per_test AS avg_variants_per_test, t.avg_duration_days AS avg_duration_daysFROM ( SELECT a.status, a.status AS status, COUNT(*) AS tests_count, COUNT(*) FILTER (WHERE a.winner_variant_id IS NOT NULL) AS tests_with_winner_declared_count, AVG(vc.variant_count) AS avg_variants_per_test, AVG(CAST(vc.variant_count AS NUMERIC(18,6))) AS avg_variants_per_test, AVG(CASE WHEN a.started_at IS NOT NULL AND a.ended_at IS NOT NULL THEN EXTRACT(EPOCH FROM (a.ended_at - a.started_at)) / 86400.0 END) AS avg_duration_days THEN {{seconds_between(a.started_at, a.ended_at)}} / 86400.0 END) AS avg_duration_days FROM ab_tests a LEFT JOIN ( SELECT ab_test_id, COUNT(*) AS variant_count FROM ab_variants GROUP BY ab_test_id ) vc ON vc.ab_test_id = a.id GROUP BY a.status) tORDER BY t.tests_count DESC, t.status ASCORDER BY t.tests_count DESC NULLS FIRST, t.status ASC NULLS LAST
SELECT t.status AS status, t.tests_count AS tests_count, t.tests_count * 100.0 / (SELECT COUNT(*) FROM ab_tests) AS share_of_tests_pct, t.tests_with_winner_declared_count AS tests_with_winner_declared_count, t.avg_variants_per_test AS avg_variants_per_test, t.avg_duration_days AS avg_duration_days FROM ( SELECT a.status AS status, COUNT(*) AS tests_count, COUNT(*) FILTER (WHERE a.winner_variant_id IS NOT NULL) AS tests_with_winner_declared_count, AVG(CAST(vc.variant_count AS NUMERIC(18,6))) AS avg_variants_per_test, AVG(CASE WHEN a.started_at IS NOT NULL AND a.ended_at IS NOT NULL THEN CAST(EXTRACT(EPOCH FROM (a.ended_at - a.started_at)) AS NUMERIC(18,6)) / 86400.0 END) AS avg_duration_days FROM ab_tests a LEFT JOIN ( SELECT ab_test_id, COUNT(*) AS variant_count FROM ab_variants GROUP BY ab_test_id ) vc ON vc.ab_test_id = a.id GROUP BY a.status ) t ORDER BY t.tests_count DESC NULLS FIRST, t.status ASC NULLS LAST
SELECT t.status AS status, t.tests_count AS tests_count, t.tests_count * 100.0 / (SELECT COUNT(*) FROM ab_tests) AS share_of_tests_pct, t.tests_with_winner_declared_count AS tests_with_winner_declared_count, t.avg_variants_per_test AS avg_variants_per_test, t.avg_duration_days AS avg_duration_days FROM ( SELECT a.status AS status, COUNT(*) AS tests_count, COUNT(*) FILTER (WHERE a.winner_variant_id IS NOT NULL) AS tests_with_winner_declared_count, AVG(CAST(vc.variant_count AS NUMERIC(18,6))) AS avg_variants_per_test, AVG(CASE WHEN a.started_at IS NOT NULL AND a.ended_at IS NOT NULL THEN CAST(divideDecimal(toDecimal128(dateDiff('microsecond', a.started_at, a.ended_at), 0), toDecimal128(1000000, 0), 6) AS Nullable(Decimal(18, 6))) / 86400.0 END) AS avg_duration_days FROM ab_tests a LEFT JOIN ( SELECT ab_test_id, COUNT(*) AS variant_count FROM ab_variants GROUP BY ab_test_id ) vc ON vc.ab_test_id = a.id GROUP BY a.status ) t ORDER BY t.tests_count DESC NULLS FIRST, t.status ASC NULLS LAST
The agents' own records, as the role play wrote them; only the personal data of the person who ran it is redacted
Report request from Sofie Nilsen (analyst for the Head of Growth Marketing): Title: Do we run A/B tests, and do we act on the results? Question: How many A/B tests has the platform run, in what state are they, and how often does a test actually end with a declared winner? Grain: one row per ab_tests.status value Columns: - status - ab_tests.status (draft, running, paused, completed, archived) - tests_count - count of ab_tests in that status, all tenants, all-time - share_of_tests_pct - tests_count / total tests across all statuses * 100, rounded to 1 decimal - tests_with_winner_declared_count - count of tests in that status where winner_variant_id is not null - avg_variants_per_test - average number of linked ab_variants rows per test in that status, rounded to 1 decimal - avg_duration_days - average of (ended_at - started_at) in days for tests in that status where both are not null, rounded to 1 decimal Details: Source: ab_tests left joined to ab_variants (count per ab_test_id) for the variants average; no date filter, all-time, all tenants, since this is a first look at whether the capability is used at all. Order by tests_count descending, tie-break status ascending. Check your query with the warehouse's dry_run tool, then hand it in with submit.
dry_runSELECT t.status, t.tests_count, ROUND(t.tests_count * 100.0 / (SELECT COUNT(*) FROM ab_tests), 1) AS share_of_tests_pct, t.tests_with_winner_declared_count, ROUND(t.avg_variants_per_test, 1) AS avg_variants_per_test, ROUND(t.avg_duration_days, 1) AS avg_duration_days FROM ( SELECT a.status, COUNT(*) AS tests_count, COUNT(*) FILTER (WHERE a.winner_variant_id IS NOT NULL) AS tests_with_winner_declared_count, AVG(vc.variant_count) AS avg_variants_per_test, AVG(CASE WHEN a.started_at IS NOT NULL AND a.ended_at IS NOT NULL THEN EXTRACT(EPOCH FROM (a.ended_at - a.started_at)) / 86400.0 END) AS avg_duration_days FROM ab_tests a LEFT JOIN ( SELECT ab_test_id, COUNT(*) AS variant_count FROM ab_variants GROUP BY ab_test_id ) vc ON vc.ab_test_id = a.id GROUP BY a.status ) t ORDER BY t.tests_count DESC, t.status ASC
STATUS: COMPILES (dry run on the empty schema, no data read) COLUMNS: status, tests_count, share_of_tests_pct, tests_with_winner_declared_count, avg_variants_per_test, avg_duration_days
submitSELECT t.status, t.tests_count, ROUND(t.tests_count * 100.0 / (SELECT COUNT(*) FROM ab_tests), 1) AS share_of_tests_pct, t.tests_with_winner_declared_count, ROUND(t.avg_variants_per_test, 1) AS avg_variants_per_test, ROUND(t.avg_duration_days, 1) AS avg_duration_days FROM ( SELECT a.status, COUNT(*) AS tests_count, COUNT(*) FILTER (WHERE a.winner_variant_id IS NOT NULL) AS tests_with_winner_declared_count, AVG(vc.variant_count) AS avg_variants_per_test, AVG(CASE WHEN a.started_at IS NOT NULL AND a.ended_at IS NOT NULL THEN EXTRACT(EPOCH FROM (a.ended_at - a.started_at)) / 86400.0 END) AS avg_duration_days FROM ab_tests a LEFT JOIN ( SELECT ab_test_id, COUNT(*) AS variant_count FROM ab_variants GROUP BY ab_test_id ) vc ON vc.ab_test_id = a.id GROUP BY a.status ) t ORDER BY t.tests_count DESC, t.status ASC
Submitted to tonight's batch. Your work on this request is done.