DB Olympics

Queries · q408 · Support Operations Manager · week 2, night 4

Studio Vrij carrier performance by month, May-July focus

“Which of Studio Vrij's carriers caused the May-July 2025 delivery breakdown, and did its performance fully recover afterward?”

Manager · asked the questionMia SchultzSupport Operations Manager. Built support tooling and processes at a software company.
Analyst · planned the reportBen CarterQuantifier: puts a money value on every finding.
Engineer · wrote the SQLOmarPragmatic: the shortest correct query, aggregates first and joins dimensions afterwards, FILTER clauses for conditional counts.

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 Support Operations Manager's desk

    Week 1; shared with Daniel Achterberg, VP Customer Experience

    Review how the helpdesk runs: queues and agent groups, use of macros and knowledge articles, SLA targets and breaches, and what makes tickets slow.

  2. Mia Schultz writes to Ben Carter

    The manager, at the start of week 2

    Subject: Re: Helpdesk Operating Review — great start, here's where to push next

    Ben,

    This is exactly the kind of baseline I wanted — and the speed-to-CSAT finding alone is worth putting in front of Daniel as-is. A few things stood out that I want sharpened before we present or act on them.

    What surprised me / needs explaining:

    • Marrowby & Vane and Studio Vrij are clearly our weak spot, but "under-resourced vs. harder cases" are two very different fixes (hire vs. retrain/reprioritize), and right now we can't tell which it is.
    • The macro usage number not reconciling with actual reply volume bothers me — I'd rather have no macro story this week than a wrong one, so let's not repeat that figure anywhere until it's explained.
    • The topic/tag breakdown (damaged, account, product-question) is useful but I don't want to act on it until we know how much of our ticket volume isn't tagged at all.

    Questions for next week, in priority order:

    1. For Marrowby & Vane and Studio Vrij specifically: is their breach rate because they're thinner on agents relative to their ticket load, or because their tickets take genuinely longer regardless of staffing (harder issues, bigger customers, more back-and-forth)? I want enough to recommend either "add headcount" or "something else is going on" with confidence.
    2. Before we use the macro usage figures for anything: what is that count actually tracking, and can we get a trustworthy sense of how much agents lean on canned replies versus writing from scratch?
    3. What share of tickets carry no topic tag at all, and does that change the story on which topics breach most? I don't want to walk into a training conversation with a skewed sample.
    4. If there's room: can we get even a rough signal on whether people who view a knowledge article before contacting us end up not filing a ticket at all, or filing a faster one? Even a partial read would tell us if KB investment is worth pushing on next quarter.

    Thanks — this is shaping up well. Let's make next week about turning the Marrowby & Vane / Studio Vrij question into something actionable.

    Mia

  3. Ben Carter plans the night

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

    The picture is now very clear and it changes the recommendation completely. Report 1 shows Marrowby & Vane gets 51.6% of shipments from Albion Parcel — the exact carrier the COO team flagged as broken from November onward — while Report 2 shows Marrowby & Vane's delivery-tagged tickets were near-normal all year (240-1,196 min/ticket, Feb-Oct) until November (9,533 min, 61.8% breach) and December (19,274 min, 100% breach). That's a live, ongoing carrier failure, not a staffing gap. Studio Vrij tells a different story: its delivery-ticket resolution time exploded in May-July 2025 (8,528 / 29,549 / 8,763 minutes) and then fully recovered by September-December (83-680 minutes, 0% breach) — this matches almost exactly what the VP Customer Experience team posted last week about a merchant's 'local May 2025 delivery breakdown... not a platform-wide issue.' That was very likely Studio Vrij, and it's already over. Neither merchant looks like a 'hire more agents' case. Tonight I want to (1) pin the Albion Parcel collapse specifically to Marrowby & Vane's own shipments month-by-month to nail the mechanism and check if it's still ongoing, (2) find which of Studio Vrij's carriers caused the May-July spike and confirm it's genuinely resolved, and (3) run the clean controlled comparison Mia actually needs for a decision: strip the known incident months out of each tenant's numbers and see if what's left still looks worse than Cragsley's baseline, or whether the whole gap was the carrier event. On the knowledge-base question: the event_name inventory (Report 3) shows only 8 tracked events platform-wide — none related to viewing a help/KB article — so combined with last week's zero-match page_views test, I'm closing that question as 'not measurable with current instrumentation' rather than spending another slot guessing.

    Studio Vrij carrier performance by month, May-July focus
    Question
    Which of Studio Vrij's carriers caused the May-July 2025 delivery breakdown, and did its performance fully recover afterward?
    One row per
    (carrier, month) in 2025, for Studio Vrij's two main carriers (Lowlands Express, Polder Post)
    Columns
    • carrier
    • month_label (YYYY-MM)
    • shipment_count (shipped_at that month)
    • avg_delivery_days
    • pct_delivered_within_3_days
  4. Omar 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
      s.carrier AS carrier,
      cd.month_label AS month_label,
      COUNT(*) AS shipment_count,
      ROUND(AVG(EXTRACT(EPOCH FROM (s.delivered_at - s.shipped_at)) / 86400.0) FILTER (WHERE s.delivered_at IS NOT NULL), 1) AS avg_delivery_days,
      ROUND(100.0 * COUNT(*) FILTER (WHERE s.delivered_at IS NOT NULL AND s.delivered_at - s.shipped_at <= INTERVAL '3 days')
            / NULLIF(COUNT(*) FILTER (WHERE s.delivered_at IS NOT NULL), 0), 1) AS pct_delivered_within_3_days
    FROM shipments s
    JOIN fulfillments f ON f.id = s.fulfillment_id
    JOIN orders o ON o.id = f.order_id
    JOIN tenants t ON t.id = o.tenant_id
    JOIN calendar_days cd ON cd.calendar_date = CAST(s.shipped_at AS date)
    WHERE t.name = 'Studio Vrij'
      AND s.carrier IN ('Lowlands Express', 'Polder Post')
      AND s.shipped_at >= DATE '2025-01-01'
      AND s.shipped_at < DATE '2026-01-01'
    GROUP BY s.carrier, cd.month_label
    ORDER BY s.carrier, cd.month_label

    “Query compiles and returns exactly the requested columns. Submitting.”

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

    “Submitted. The report covers all 12 months of 2025 for both carriers at Studio Vrij, so Ben can see the May–July dip against the surrounding months and judge whether each carrier's performance (avg delivery days and % delivered within 3 days) returned to baseline afterward.”

  5. The report comes back overnight

    As Ben Carter saw it, from the small dataset the agents worked on

    carrier          | month_label | shipment_count | avg_delivery_days | pct_delivered_within_3_days
    -----------------+-------------+----------------+-------------------+----------------------------
    Lowlands Express | 2025-01     |             23 |               2.4 |                        78.3
    Lowlands Express | 2025-02     |             12 |               2.0 |                        83.3
    Lowlands Express | 2025-03     |             23 |               2.2 |                        73.9
    Lowlands Express | 2025-04     |             17 |               2.0 |                        76.5
    Lowlands Express | 2025-05     |             49 |               2.4 |                        71.4
    Lowlands Express | 2025-06     |             37 |               2.5 |                        64.9
    Lowlands Express | 2025-07     |             28 |               2.6 |                        60.7
    Lowlands Express | 2025-08     |             11 |               2.1 |                        81.8
    Lowlands Express | 2025-09     |             24 |               2.4 |                        75.0
    Lowlands Express | 2025-10     |             34 |               3.1 |                        52.9
    Lowlands Express | 2025-11     |             35 |               2.2 |                        88.6
    Lowlands Express | 2025-12     |             54 |               2.8 |                        67.3
    Polder Post      | 2025-01     |             16 |               2.2 |                        75.0
    Polder Post      | 2025-02     |              7 |               2.0 |                        85.7
    Polder Post      | 2025-03     |             13 |               3.1 |                        30.8
    Polder Post      | 2025-04     |             12 |               3.1 |                        50.0
    Polder Post      | 2025-05     |             18 |               2.1 |                        88.9
    Polder Post      | 2025-06     |             17 |               2.6 |                        70.6
    Polder Post      | 2025-07     |              8 |               2.3 |                        75.0
    Polder Post      | 2025-08     |             10 |               2.7 |                        60.0
    Polder Post      | 2025-09     |              7 |               3.2 |                        42.9
    Polder Post      | 2025-10     |             16 |               3.1 |                        50.0
    Polder Post      | 2025-11     |             20 |               2.6 |                        65.0
    Polder Post      | 2025-12     |             44 |               2.7 |                        61.0
    (24 rows)
  6. What came of it

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

    It builds on:

  7. It becomes benchmark query q408

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

    • numericsdocs/NUMERICS.md: rounding removed; results keep full precision
    • numericsdocs/NUMERICS.md: EXTRACT(EPOCH FROM (b - a)) cast to NUMERIC(18,6)
    • placeholderseconds between
    • 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  s.carrier AS carrier,  cd.month_label AS month_label,  COUNT(*) AS shipment_count,  ROUND(AVG(EXTRACT(EPOCH FROM (s.delivered_at - s.shipped_at)) / 86400.0) FILTER (WHERE s.delivered_at IS NOT NULL), 1) AS avg_delivery_days,  ROUND(100.0 * COUNT(*) FILTER (WHERE s.delivered_at IS NOT NULL AND s.delivered_at - s.shipped_at <= INTERVAL '3 days')        / NULLIF(COUNT(*) FILTER (WHERE s.delivered_at IS NOT NULL), 0), 1) AS pct_delivered_within_3_days  AVG({{seconds_between(s.shipped_at, s.delivered_at)}} / 86400.0) FILTER (WHERE s.delivered_at IS NOT NULL) AS avg_delivery_days,  100.0 * COUNT(*) FILTER (WHERE s.delivered_at IS NOT NULL AND s.delivered_at - s.shipped_at <= INTERVAL '3 days')  / NULLIF(COUNT(*) FILTER (WHERE s.delivered_at IS NOT NULL), 0) AS pct_delivered_within_3_daysFROM shipments sJOIN fulfillments f ON f.id = s.fulfillment_idJOIN orders o ON o.id = f.order_idJOIN tenants t ON t.id = o.tenant_idJOIN calendar_days cd ON cd.calendar_date = CAST(s.shipped_at AS date)WHERE t.name = 'Studio Vrij'  AND s.carrier IN ('Lowlands Express', 'Polder Post')  AND s.shipped_at >= DATE '2025-01-01'  AND s.shipped_at < DATE '2026-01-01'GROUP BY s.carrier, cd.month_labelORDER BY s.carrier, cd.month_labelORDER BY s.carrier NULLS LAST, cd.month_label NULLS LAST
    SELECT
      s.carrier AS carrier,
      cd.month_label AS month_label,
      COUNT(*) AS shipment_count,
      AVG(CAST(EXTRACT(EPOCH FROM (s.delivered_at - s.shipped_at)) AS NUMERIC(18,6)) / 86400.0) FILTER (WHERE s.delivered_at IS NOT NULL) AS avg_delivery_days,
      100.0 * COUNT(*) FILTER (WHERE s.delivered_at IS NOT NULL AND s.delivered_at - s.shipped_at <= INTERVAL '3 days')
      / NULLIF(COUNT(*) FILTER (WHERE s.delivered_at IS NOT NULL), 0) AS pct_delivered_within_3_days
    FROM shipments s
    JOIN fulfillments f ON f.id = s.fulfillment_id
    JOIN orders o ON o.id = f.order_id
    JOIN tenants t ON t.id = o.tenant_id
    JOIN calendar_days cd ON cd.calendar_date = CAST(s.shipped_at AS date)
    WHERE t.name = 'Studio Vrij'
      AND s.carrier IN ('Lowlands Express', 'Polder Post')
      AND s.shipped_at >= DATE '2025-01-01'
      AND s.shipped_at < DATE '2026-01-01'
    GROUP BY s.carrier, cd.month_label
    ORDER BY s.carrier NULLS LAST, cd.month_label NULLS LAST
    10 ms100 ms1 sHyper39.0 msDuckDB84.4 msGizmoSQL91.7 msclickhouse_brew186 msFirebolt206 msDataFusionwrong resultClickHouseerror
    • DataFusionrow 1: col 5: "77.0103320800025277259945021959619577237827" vs "100.0"
    • ClickHouseCode: 43. DB::Exception: No operation lessOrEquals between Decimal(18, 6) and IntervalDay: while executing 'FUNCTION lessOrEquals(minus(__table1.delivered_at, __table1.shipped_at) :: 12, _CAST(3_IntervalDay, 'IntervalDay'_String) :: 10) -> lessOrEquals(minus(__table1.delivered_at, __table1.shipped_a
  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

    Omar's whole session, 7 turns
    • The request, as Omar received it
      Report request from Ben Carter (analyst for the Support Operations Manager):
      
      Title: Studio Vrij carrier performance by month, May-July focus
      Question: Which of Studio Vrij's carriers caused the May-July 2025 delivery breakdown, and did its performance fully recover afterward?
      Grain: one row per (carrier, month) in 2025, for Studio Vrij's two main carriers (Lowlands Express, Polder Post)
      Columns:
      - carrier
      - month_label (YYYY-MM)
      - shipment_count (shipped_at that month)
      - avg_delivery_days
      - pct_delivered_within_3_days
      Details: Window: shipments.shipped_at between 2025-01-01 and 2025-12-31, restricted to tenant = Studio Vrij and carrier in ('Lowlands Express', 'Polder Post'). Source table: shipments. Compute avg_delivery_days and pct_delivered_within_3_days only over shipments with both shipped_at and delivered_at populated. Order by carrier, then month_label ascending. Round avg_delivery_days to 1 decimal, pct to 1 decimal percent.
      
      Check your query with the warehouse's dry_run tool, then hand it in with submit.
    • Omar calls dry_run
      SELECT
        s.carrier AS carrier,
        cd.month_label AS month_label,
        COUNT(*) AS shipment_count,
        ROUND(AVG(EXTRACT(EPOCH FROM (s.delivered_at - s.shipped_at)) / 86400.0) FILTER (WHERE s.delivered_at IS NOT NULL), 1) AS avg_delivery_days,
        ROUND(100.0 * COUNT(*) FILTER (WHERE s.delivered_at IS NOT NULL AND s.delivered_at - s.shipped_at <= INTERVAL '3 days')
              / NULLIF(COUNT(*) FILTER (WHERE s.delivered_at IS NOT NULL), 0), 1) AS pct_delivered_within_3_days
      FROM shipments s
      JOIN fulfillments f ON f.id = s.fulfillment_id
      JOIN orders o ON o.id = f.order_id
      JOIN tenants t ON t.id = o.tenant_id
      JOIN calendar_days cd ON cd.calendar_date = CAST(s.shipped_at AS date)
      WHERE t.name = 'Studio Vrij'
        AND s.carrier IN ('Lowlands Express', 'Polder Post')
        AND s.shipped_at >= DATE '2025-01-01'
        AND s.shipped_at < DATE '2026-01-01'
      GROUP BY s.carrier, cd.month_label
      ORDER BY s.carrier, cd.month_label
    • The warehouse answers
      STATUS: COMPILES (dry run on the empty schema, no data read)
      COLUMNS: carrier, month_label, shipment_count, avg_delivery_days, pct_delivered_within_3_days
    • OmarQuery compiles and returns exactly the requested columns. Submitting.
    • Omar calls submit
      SELECT
        s.carrier AS carrier,
        cd.month_label AS month_label,
        COUNT(*) AS shipment_count,
        ROUND(AVG(EXTRACT(EPOCH FROM (s.delivered_at - s.shipped_at)) / 86400.0) FILTER (WHERE s.delivered_at IS NOT NULL), 1) AS avg_delivery_days,
        ROUND(100.0 * COUNT(*) FILTER (WHERE s.delivered_at IS NOT NULL AND s.delivered_at - s.shipped_at <= INTERVAL '3 days')
              / NULLIF(COUNT(*) FILTER (WHERE s.delivered_at IS NOT NULL), 0), 1) AS pct_delivered_within_3_days
      FROM shipments s
      JOIN fulfillments f ON f.id = s.fulfillment_id
      JOIN orders o ON o.id = f.order_id
      JOIN tenants t ON t.id = o.tenant_id
      JOIN calendar_days cd ON cd.calendar_date = CAST(s.shipped_at AS date)
      WHERE t.name = 'Studio Vrij'
        AND s.carrier IN ('Lowlands Express', 'Polder Post')
        AND s.shipped_at >= DATE '2025-01-01'
        AND s.shipped_at < DATE '2026-01-01'
      GROUP BY s.carrier, cd.month_label
      ORDER BY s.carrier, cd.month_label
    • The warehouse answers
      Submitted to tonight's batch. Your work on this request is done.
    • OmarSubmitted. The report covers all 12 months of 2025 for both carriers at Studio Vrij, so Ben can see the May–July dip against the surrounding months and judge whether each carrier's performance (avg delivery days and % delivered within 3 days) returned to baseline afterward.