DB Olympics

Queries · q341 · VP Platform Engineering · week 2, night 3

Checkout/Storefront Outage Timeline, Nov 28 2025

“Exactly when did the checkout/storefront outage start and end on Nov 28 2025?”

Manager · asked the questionDiego MoralesVP Platform Engineering. Former reliability lead at a payments company. Owns uptime and the integrations merchants depend on.
Analyst · planned the reportLucas MoreauPragmatic: answers the question asked with the simplest reliable report.
Engineer · wrote the SQLInesThinks in window functions: ranks, running totals, LAG/LEAD for comparisons, percent-of-total.

Fictional people at a fictional company, each played by a language-model agent. Who they are and what they are told

  1. A business event lands on the VP Platform Engineering's desk

    Week 1; shared with Samuel Whitcombe, Head of Merchant Success

    Leadership wants a review of platform reliability in 2025: failed and slow background jobs, health check failures, rate limiting, webhook delivery problems, and which merchants felt them.

  2. Diego Morales writes to Lucas Moreau

    The manager, at the start of week 2

    Subject: Re: 2025 Platform Reliability Review — good start, a few things I need tightened up

    Lucas,

    Thanks — this is useful and more honest than I expected on the limits of what we can see. A few things stood out and need more work before Friday's memo goes to leadership.

    First, the retention gap is itself a finding, not just a caveat. We're flying with 90 days of job history and 60 days of health-check history — that means we genuinely don't know how 2025 looked before October. I want that stated plainly and separately in the memo as a reliability/observability gap in its own right, not buried as a footnote under the carts.remind story.

    Second, the ERP/WMS/Accounting webhook stuck-retry pattern is, to me, the most important and actionable thing in here — more than the one-week carts.remind incident. I want that properly validated and sized, not eyeballed, before we say anything about it to leadership.

    Questions for this week:

    1. Can you redo the webhook comparison correctly and tell me: how many merchants are affected by this stuck-retry pattern, and what's the revenue or order volume behind them? I want to know if this is a handful of our biggest accounts or a long tail.
    2. Has the ~15% stuck-retry rate on those sync webhooks been happening all year, or is it new/recent? Even without full job history, is there any way to tell whether this is a longstanding bug we've lived with or something that regressed recently?
    3. On carts.remind — you said it looks tied to a feature flag or config rather than load. Can we get more confidence on that? I want to know if this is a one-off we already fixed, or a latent risk that could recur with other job types.
    4. Setting aside strict proof of causation, can you give me your best read on whether the ticket-volume climb for the 10 affected tenants in the weeks before the failures showed up in our logs is something merchants were telling us about directly (i.e., check if their tickets mention sync/reminders/missing carts) — even a rough read would tell us if our support channel was effectively an early warning system we ignored.

    On rate limiting: agreed, drop it for this cycle — don't spend a slot trying to force an answer out of config data alone. Just flag it as a 2026 instrumentation ask, as you already have.

    Priority for your remaining slots: #1 and #2 above. The webhook/sync issue is the one I can take into a fix-it conversation with engineering next week if the numbers hold up — I'd rather have that nailed down than more polish on the carts.remind narrative.

    Diego

  3. Lucas Moreau plans the night

    The analyst · week 2, night 3, request 1 of 3

    Report 2 from last night changes the scale of this story substantially: at the 14:00 UTC hour check on Nov 28 2025, BOTH 'checkout' and 'storefront' components were 100% unhealthy (111/111 checks failing, latency pegged at a 10,000ms timeout ceiling) - a full, unambiguous outage, not the mild 2.44% weekly blip I reported last week (that number was just this severe hour diluted across a whole week of otherwise-healthy checks). And critically, Nov 28 2025 is Black Friday - so if checkout itself was down for part of the busiest shopping day of the year, that's a much bigger finding than '10 merchants' cart-reminder emails failed,' and it would affect every merchant trying to check out then, not just the 10 using carts.remind. I didn't request a 15:00 bucket so I can't see the second (15:40) failure's health-check status yet, and my hourly buckets are too coarse to know exactly when the outage started/ended. Report 3 (ticket subject search) came back empty - no evidence in ticket subjects that shoppers flagged cart/reminder problems before Nov 24, so I can't support the 'support was an early warning sign' theory from this angle; I'm treating that as a genuine (if limited - subjects only, not message bodies) negative result rather than spending more budget on it, since the checkout-outage/Black-Friday angle is now clearly the more important thread with one night left. Tonight's 3 slots: (1) pin down the exact start/end of the checkout outage at finer time resolution; (2) measure the actual order-volume impact hour-by-hour on Nov 28 itself; (3) put Nov 28 in context against surrounding Fridays and Black Friday 2024 so Diego has a real 'how much did this cost us' number for leadership.

    Checkout/Storefront Outage Timeline, Nov 28 2025
    Question
    Exactly when did the checkout/storefront outage start and end on Nov 28 2025?
    One row per
    30-minute interval and component, for checkout and storefront only, 13:00-17:00 UTC on 2025-11-28
    Columns
    • interval_start
    • component
    • total_checks
    • unhealthy_checks
    • unhealthy_rate_pct
    • avg_latency_ms
  4. Ines writes the SQL

    The engineer · 1 dry run on the empty schema, then the submission

    Dry run 1 · STATUS: COMPILES (dry run on the empty schema, no data read)
    SELECT 
      date_trunc('hour', checked_at) + (floor(extract(minute from checked_at)/30)::int * interval '30 minute') AS interval_start,
      component,
      count(*) AS total_checks,
      count(*) FILTER (WHERE is_healthy = false) AS unhealthy_checks,
      round(100.0 * count(*) FILTER (WHERE is_healthy = false) / count(*), 2) AS unhealthy_rate_pct,
      round(avg(latency_ms)) AS avg_latency_ms
    FROM system_health_checks
    WHERE checked_at >= timestamp '2025-11-28 13:00:00' AND checked_at < timestamp '2025-11-28 17:00:00'
      AND component IN ('checkout','storefront')
    GROUP BY 1,2
    ORDER BY interval_start ASC, component ASC

    “Query compiles cleanly with the expected columns. Submitting now.”

    Submitted · the SQL of the last dry run, unchanged · Submitted to tonight's batch. Your work on this request is done.

    “Submitted. The report will produce one row per 30-minute interval (13:00–17:00 UTC, 8 intervals) for each of the checkout and storefront components, showing total checks, unhealthy checks, unhealthy rate %, and average latency — which should make the outage window visible as a spike in the unhealthy rate.”

  5. The report comes back overnight

    As Lucas Moreau saw it, from the small dataset the agents worked on

    interval_start      | component  | total_checks | unhealthy_checks | unhealthy_rate_pct | avg_latency_ms
    --------------------+------------+--------------+------------------+--------------------+---------------
    2025-11-28 14:00:00 | checkout   |          111 |              111 |              100.0 |        10000.0
    2025-11-28 14:00:00 | storefront |          111 |              111 |              100.0 |        10000.0
    2025-11-28 16:00:00 | checkout   |          111 |                3 |                2.7 |          451.0
    2025-11-28 16:00:00 | storefront |          111 |                0 |                0.0 |          101.0
    (4 rows)
  6. What came of it

    The memo and the queries that followed; links found by title, so inferred

    Later queries that build on this report:

    It builds on:

  7. It becomes benchmark query q341

    Changed only where the benchmark needs the same result on every system

    • spellingcast
    • numericsdocs/NUMERICS.md: rounding removed; results keep full precision; AVG over an integer computed as a decimal: AVG(CAST(x AS NUMERIC(18,6)))
    • determinismthe standard leaves the place of NULLs in a sort to the implementation: NULLS LAST ascending, NULLS FIRST descending, as in the reference results (2×)
    The benchmark text, against the submitted SQL
    SELECT   date_trunc('hour', checked_at) + (floor(extract(minute from checked_at)/30)::int * interval '30 minute') AS interval_start,  date_trunc('hour', checked_at) + (CAST(floor(extract(minute from checked_at)/30) AS int) * interval '30 minute') AS interval_start,  component,  count(*) AS total_checks,  count(*) FILTER (WHERE is_healthy = false) AS unhealthy_checks,  round(100.0 * count(*) FILTER (WHERE is_healthy = false) / count(*), 2) AS unhealthy_rate_pct,  round(avg(latency_ms)) AS avg_latency_ms  100.0 * count(*) FILTER (WHERE is_healthy = false) / count(*) AS unhealthy_rate_pct,  avg(cast(latency_ms as numeric(18,6))) AS avg_latency_msFROM system_health_checksWHERE checked_at >= timestamp '2025-11-28 13:00:00' AND checked_at < timestamp '2025-11-28 17:00:00'  AND component IN ('checkout','storefront')GROUP BY 1,2ORDER BY interval_start ASC, component ASCORDER BY interval_start ASC NULLS LAST, component ASC NULLS LAST
    SELECT 
      date_trunc('hour', checked_at) + (CAST(floor(extract(minute from checked_at)/30) AS int) * interval '30 minute') AS interval_start,
      component,
      count(*) AS total_checks,
      count(*) FILTER (WHERE is_healthy = false) AS unhealthy_checks,
      100.0 * count(*) FILTER (WHERE is_healthy = false) / count(*) AS unhealthy_rate_pct,
      avg(cast(latency_ms as numeric(18,6))) AS avg_latency_ms
    FROM system_health_checks
    WHERE checked_at >= timestamp '2025-11-28 13:00:00' AND checked_at < timestamp '2025-11-28 17:00:00'
      AND component IN ('checkout','storefront')
    GROUP BY 1,2
    ORDER BY interval_start ASC NULLS LAST, component ASC NULLS LAST
    1 ms10 ms100 msHyper2.5 msDuckDB6.1 msGizmoSQL5.1 msclickhouse_brew14.5 msFirebolt11.0 msDataFusionerrorClickHouseerror
    • DataFusionError during planning: Cannot get result type for temporal operation Int32 * Interval(MonthDayNano): Invalid argument error: Invalid interval arithmetic operation: Interval(MonthDayNano) * Interval(MonthDayNano)
    • ClickHouseCode: 43. DB::Exception: Illegal types Int32 and IntervalMinute of arguments of function multiply: In scope SELECT date_trunc('hour', checked_at) + (CAST(floor(toMinute(checked_at) / 30), 'int') * toIntervalMinute(30)) AS interval_start, component, count(*) AS total_checks, countIf(is_healthy = fals
  8. Everything, as recorded

    The agents' own records, as the role play wrote them; only the personal data of the person who ran it is redacted

    Ines's whole session, 7 turns
    • The request, as Ines received it
      Report request from Lucas Moreau (analyst for the VP Platform Engineering):
      
      Title: Checkout/Storefront Outage Timeline, Nov 28 2025
      Question: Exactly when did the checkout/storefront outage start and end on Nov 28 2025?
      Grain: one row per 30-minute interval and component, for checkout and storefront only, 13:00-17:00 UTC on 2025-11-28
      Columns:
      - interval_start
      - component
      - total_checks
      - unhealthy_checks
      - unhealthy_rate_pct
      - avg_latency_ms
      Details: Table system_health_checks. Filter checked_at >= 2025-11-28 13:00:00 and < 2025-11-28 17:00:00, component in ('checkout','storefront'). Group by 30-minute interval (floor checked_at to the nearest 30 minutes) and component. unhealthy_rate_pct = is_healthy=false count / total_checks * 100, rounded 2dp. avg_latency_ms over non-null latency_ms, rounded to whole number. Order by interval_start ascending, component ascending.
      
      Check your query with the warehouse's dry_run tool, then hand it in with submit.
    • Ines calls dry_run
      SELECT 
        date_trunc('hour', checked_at) + (floor(extract(minute from checked_at)/30)::int * interval '30 minute') AS interval_start,
        component,
        count(*) AS total_checks,
        count(*) FILTER (WHERE is_healthy = false) AS unhealthy_checks,
        round(100.0 * count(*) FILTER (WHERE is_healthy = false) / count(*), 2) AS unhealthy_rate_pct,
        round(avg(latency_ms)) AS avg_latency_ms
      FROM system_health_checks
      WHERE checked_at >= timestamp '2025-11-28 13:00:00' AND checked_at < timestamp '2025-11-28 17:00:00'
        AND component IN ('checkout','storefront')
      GROUP BY 1,2
      ORDER BY interval_start ASC, component ASC
    • The warehouse answers
      STATUS: COMPILES (dry run on the empty schema, no data read)
      COLUMNS: interval_start, component, total_checks, unhealthy_checks, unhealthy_rate_pct, avg_latency_ms
    • InesQuery compiles cleanly with the expected columns. Submitting now.
    • Ines calls submit
      SELECT 
        date_trunc('hour', checked_at) + (floor(extract(minute from checked_at)/30)::int * interval '30 minute') AS interval_start,
        component,
        count(*) AS total_checks,
        count(*) FILTER (WHERE is_healthy = false) AS unhealthy_checks,
        round(100.0 * count(*) FILTER (WHERE is_healthy = false) / count(*), 2) AS unhealthy_rate_pct,
        round(avg(latency_ms)) AS avg_latency_ms
      FROM system_health_checks
      WHERE checked_at >= timestamp '2025-11-28 13:00:00' AND checked_at < timestamp '2025-11-28 17:00:00'
        AND component IN ('checkout','storefront')
      GROUP BY 1,2
      ORDER BY interval_start ASC, component ASC
    • The warehouse answers
      Submitted to tonight's batch. Your work on this request is done.
    • InesSubmitted. The report will produce one row per 30-minute interval (13:00–17:00 UTC, 8 intervals) for each of the checkout and storefront components, showing total checks, unhealthy checks, unhealthy rate %, and average latency — which should make the outage window visible as a spike in the unhealthy rate.