Queries · q238 · Chief Operating Officer · week 2, night 3
“In the same order-level metric I've already reported to Priya (pct within 5 days), how much better would our overall delivery reliability be if the three weak carriers matched everyone else?”
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 2
Subject: Carrier picture confirms it — now I want to know what we can actually fix
Lena,
This is exactly the clarity I was hoping for — "it's the carriers, not the warehouses" is a much more actionable story than "fulfillment is inconsistent." A few things jumped out, including from what Daniel's and Tomasz's teams posted this week, and I want to chase them down before we draft anything for merchants or carrier partners.
What surprised me: Albion Parcel going from solid to broken in November and staying broken through December is different from Landfall and Lowlands, which sound like long-term weak performers we've just tolerated. One is a relationship we may need to end; the other looks like it could be an acute problem (capacity, a route, a depot) that might actually be fixable if we understood the trigger. I don't want to lump all three into one "bad carriers" conversation when they may need completely different responses.
I also noticed Daniel's team's finding that "where's my order" tickets spike in lockstep with late deliveries each November/December — that's a direct line from the carrier problem to support cost and customer satisfaction, and I'd like to be able to say that explicitly in my own numbers rather than borrowing his.
Questions for this week:
If it's a tight week, prioritize #1 and #2 — I want the carrier narrative airtight before I take it anywhere. Returns/restock cycle time can wait one more week if needed.
Thanks, Priya
The analyst · week 2, night 3, request 1 of 3
I can already answer most of priorities #2-#4 by hand from data I have: (a) the full-year carrier table lets me compute that today's overall transit on-time rate (pct within 3 days) is ~78%, and if the three weak carriers matched the ~88% weighted average of the other 11 carriers, overall on-time would rise to ~88% -- i.e. roughly 45% of our current unreliability sits with these three carriers, the rest is baseline slop even among good carriers. (b) the non-censored PO report fully resolves #3: pct_matured_still_open is ~0% in every quarter including the mature Oct-only slice of Q4 -- there is no real backlog, the 418 "open" POs were purely a right-censoring artifact. The late-delivery rate itself (47-59%) is real and chronic, but it's a persistent promise-miss rate, not a growing queue -- worth flagging as its own issue. (c) the vertical report resolves #4: Beauty and Apparel & Footwear have the highest fulfillment-shortfall rates (4.5-4.7% of orders), but Apparel is actually the fastest and most reliable vertical once an order fully delivers (3.84 avg days, 82.4% within 5) -- so the picking-discrepancy issue looks like a separate, real completeness problem (customers getting short quantities), not a delivery-speed problem. Tonight I want to re-express the carrier "ceiling" story in the exact metric Priya already quotes (order-level pct-within-5-days, not shipment transit), and isolate how much of the Nov-Dec dip is specifically attributable to Albion vs. everything else, plus quantify the Lowlands lane-fix opportunity -- these three numbers should make the carrier narrative airtight and actionable.
The engineer · 1 dry run on the empty schema, then the submission
WITH order_fulfillment_counts AS ( SELECT order_id, COUNT(*) AS cnt FROM fulfillments GROUP BY order_id ), fulfillment_shipment_counts AS ( SELECT fulfillment_id, COUNT(*) AS cnt FROM shipments GROUP BY fulfillment_id ), base AS ( SELECT o.id AS order_id, o.placed_at, s.carrier, s.delivered_at FROM orders o JOIN fulfillments f ON f.order_id = o.id JOIN shipments s ON s.fulfillment_id = f.id JOIN order_fulfillment_counts ofc ON ofc.order_id = o.id JOIN fulfillment_shipment_counts fsc ON fsc.fulfillment_id = f.id WHERE o.status = 'fulfilled' AND o.placed_at >= DATE '2025-01-01' AND o.placed_at < DATE '2026-01-01' AND ofc.cnt = 1 AND fsc.cnt = 1 AND s.delivered_at IS NOT NULL ), scored AS ( SELECT order_id, CASE WHEN carrier IN ('Albion Parcel','Landfall Freight','Lowlands Express') THEN 'Weak three' ELSE 'All other carriers' END AS carrier_group, (delivered_at::date - placed_at::date) AS delivery_days FROM base ) SELECT carrier_group, COUNT(*) AS orders_fully_delivered, ROUND(AVG(delivery_days)::numeric, 2) AS avg_delivery_days, ROUND(100.0 * SUM(CASE WHEN delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*), 1) AS pct_within_5_days, ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER (), 1) AS share_of_orders_pct FROM scored GROUP BY carrier_group ORDER BY carrier_group ASC
“Query compiles and returns the expected columns. Submitting.”
“Submitted. The report computes delivery reliability at the carrier-group grain ('Weak three' vs 'All other carriers') for 2025 fulfilled orders with clean single-carrier attribution, using the same pct-within-5-days metric as Priya's report, so the COO's analyst can directly compare what overall reliability would look like if the weak carriers matched the rest.”
As Lena Hartmann saw it, from the small dataset the agents worked on
carrier_group | orders_fully_delivered | avg_delivery_days | pct_within_5_days | share_of_orders_pct -------------------+------------------------+-------------------+-------------------+-------------------- All other carriers | 13696 | 3.44 | 93.4 | 66.7 Weak three | 6837 | 5.19 | 66.8 | 33.3 (2 rows)
The memo and the queries that followed; links found by title, so inferred
Later queries that build on this report:
It builds on:
Changed only where the benchmark needs the same result on every system
WITH order_fulfillment_counts AS ( SELECT order_id, COUNT(*) AS cnt FROM fulfillments GROUP BY order_id),fulfillment_shipment_counts AS ( SELECT fulfillment_id, COUNT(*) AS cnt FROM shipments GROUP BY fulfillment_id),base AS ( SELECT o.id AS order_id, o.placed_at, s.carrier, s.delivered_at o.placed_at AS placed_at, s.carrier AS carrier, s.delivered_at AS delivered_at FROM orders o JOIN fulfillments f ON f.order_id = o.id JOIN shipments s ON s.fulfillment_id = f.id JOIN order_fulfillment_counts ofc ON ofc.order_id = o.id JOIN fulfillment_shipment_counts fsc ON fsc.fulfillment_id = f.id WHERE o.status = 'fulfilled' AND o.placed_at >= DATE '2025-01-01' AND o.placed_at < DATE '2026-01-01' AND ofc.cnt = 1 AND fsc.cnt = 1 AND s.delivered_at IS NOT NULL),scored AS ( SELECT order_id, CASE WHEN carrier IN ('Albion Parcel','Landfall Freight','Lowlands Express') THEN 'Weak three' ELSE 'All other carriers' END AS carrier_group, (delivered_at::date - placed_at::date) AS delivery_days {{date_diff_days(placed_at, delivered_at)}} AS delivery_days FROM base)SELECT carrier_group, COUNT(*) AS orders_fully_delivered, ROUND(AVG(delivery_days)::numeric, 2) AS avg_delivery_days, ROUND(100.0 * SUM(CASE WHEN delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*), 1) AS pct_within_5_days, ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER (), 1) AS share_of_orders_pct AVG(CAST(delivery_days AS NUMERIC(18,6))) AS avg_delivery_days, 100.0 * SUM(CASE WHEN delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*) AS pct_within_5_days, 100.0 * COUNT(*) / SUM(COUNT(*)) OVER () AS share_of_orders_pctFROM scoredGROUP BY carrier_groupORDER BY carrier_group ASCORDER BY carrier_group ASC NULLS LAST
WITH order_fulfillment_counts AS ( SELECT order_id, COUNT(*) AS cnt FROM fulfillments GROUP BY order_id ), fulfillment_shipment_counts AS ( SELECT fulfillment_id, COUNT(*) AS cnt FROM shipments GROUP BY fulfillment_id ), base AS ( SELECT o.id AS order_id, o.placed_at AS placed_at, s.carrier AS carrier, s.delivered_at AS delivered_at FROM orders o JOIN fulfillments f ON f.order_id = o.id JOIN shipments s ON s.fulfillment_id = f.id JOIN order_fulfillment_counts ofc ON ofc.order_id = o.id JOIN fulfillment_shipment_counts fsc ON fsc.fulfillment_id = f.id WHERE o.status = 'fulfilled' AND o.placed_at >= DATE '2025-01-01' AND o.placed_at < DATE '2026-01-01' AND ofc.cnt = 1 AND fsc.cnt = 1 AND s.delivered_at IS NOT NULL ), scored AS ( SELECT order_id, CASE WHEN carrier IN ('Albion Parcel','Landfall Freight','Lowlands Express') THEN 'Weak three' ELSE 'All other carriers' END AS carrier_group, DATE_DIFF('day', placed_at, delivered_at) AS delivery_days FROM base ) SELECT carrier_group, COUNT(*) AS orders_fully_delivered, AVG(CAST(delivery_days AS NUMERIC(18,6))) AS avg_delivery_days, 100.0 * SUM(CASE WHEN delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*) AS pct_within_5_days, 100.0 * COUNT(*) / SUM(COUNT(*)) OVER () AS share_of_orders_pct FROM scored GROUP BY carrier_group ORDER BY carrier_group ASC NULLS LAST
WITH order_fulfillment_counts AS ( SELECT order_id, COUNT(*) AS cnt FROM fulfillments GROUP BY order_id ), fulfillment_shipment_counts AS ( SELECT fulfillment_id, COUNT(*) AS cnt FROM shipments GROUP BY fulfillment_id ), base AS ( SELECT o.id AS order_id, o.placed_at AS placed_at, s.carrier AS carrier, s.delivered_at AS delivered_at FROM orders o JOIN fulfillments f ON f.order_id = o.id JOIN shipments s ON s.fulfillment_id = f.id JOIN order_fulfillment_counts ofc ON ofc.order_id = o.id JOIN fulfillment_shipment_counts fsc ON fsc.fulfillment_id = f.id WHERE o.status = 'fulfilled' AND o.placed_at >= DATE '2025-01-01' AND o.placed_at < DATE '2026-01-01' AND ofc.cnt = 1 AND fsc.cnt = 1 AND s.delivered_at IS NOT NULL ), scored AS ( SELECT order_id, CASE WHEN carrier IN ('Albion Parcel','Landfall Freight','Lowlands Express') THEN 'Weak three' ELSE 'All other carriers' END AS carrier_group, (CAST(delivered_at AS DATE) - CAST(placed_at AS DATE)) AS delivery_days FROM base ) SELECT carrier_group, COUNT(*) AS orders_fully_delivered, AVG(CAST(delivery_days AS NUMERIC(18,6))) AS avg_delivery_days, 100.0 * SUM(CASE WHEN delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*) AS pct_within_5_days, 100.0 * COUNT(*) / SUM(COUNT(*)) OVER () AS share_of_orders_pct FROM scored GROUP BY carrier_group ORDER BY carrier_group ASC NULLS LAST
WITH order_fulfillment_counts AS ( SELECT order_id, COUNT(*) AS cnt FROM fulfillments GROUP BY order_id ), fulfillment_shipment_counts AS ( SELECT fulfillment_id, COUNT(*) AS cnt FROM shipments GROUP BY fulfillment_id ), base AS ( SELECT o.id AS order_id, o.placed_at AS placed_at, s.carrier AS carrier, s.delivered_at AS delivered_at FROM orders o JOIN fulfillments f ON f.order_id = o.id JOIN shipments s ON s.fulfillment_id = f.id JOIN order_fulfillment_counts ofc ON ofc.order_id = o.id JOIN fulfillment_shipment_counts fsc ON fsc.fulfillment_id = f.id WHERE o.status = 'fulfilled' AND o.placed_at >= DATE '2025-01-01' AND o.placed_at < DATE '2026-01-01' AND ofc.cnt = 1 AND fsc.cnt = 1 AND s.delivered_at IS NOT NULL ), scored AS ( SELECT order_id, CASE WHEN carrier IN ('Albion Parcel','Landfall Freight','Lowlands Express') THEN 'Weak three' ELSE 'All other carriers' END AS carrier_group, dateDiff('day', placed_at, delivered_at) AS delivery_days FROM base ) SELECT carrier_group, COUNT(*) AS orders_fully_delivered, AVG(CAST(delivery_days AS NUMERIC(18,6))) AS avg_delivery_days, 100.0 * SUM(CASE WHEN delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*) AS pct_within_5_days, 100.0 * COUNT(*) / SUM(COUNT(*)) OVER () AS share_of_orders_pct FROM scored GROUP BY carrier_group ORDER BY carrier_group 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 Lena Hartmann (analyst for the Chief Operating Officer):
Title: Order-level delivery reliability: weak carriers vs rest, 2025
Question: In the same order-level metric I've already reported to Priya (pct within 5 days), how much better would our overall delivery reliability be if the three weak carriers matched everyone else?
Grain: one row per carrier_group: 'Weak three' (Albion Parcel, Landfall Freight, Lowlands Express) vs 'All other carriers'
Columns:
- carrier_group
- orders_fully_delivered
- avg_delivery_days (placed_at to delivered_at)
- pct_within_5_days
- share_of_orders_pct
Details: Scope: orders with placed_at in 2025-01-01 through 2025-12-31, status='fulfilled', restricted to orders with exactly one row in fulfillments and that fulfillment linked to exactly one row in shipments, with that shipment's delivered_at not null (clean single-carrier attribution). delivery_days = DATEDIFF(day, orders.placed_at, shipments.delivered_at). carrier_group = 'Weak three' if shipments.carrier in ('Albion Parcel','Landfall Freight','Lowlands Express'), else 'All other carriers'. Round avg_delivery_days to 2 decimals, pct columns to 1 decimal. Order by carrier_group ascending. Expect 2 rows.
Check your query with the warehouse's dry_run tool, then hand it in with submit.dry_runWITH order_fulfillment_counts AS ( SELECT order_id, COUNT(*) AS cnt FROM fulfillments GROUP BY order_id ), fulfillment_shipment_counts AS ( SELECT fulfillment_id, COUNT(*) AS cnt FROM shipments GROUP BY fulfillment_id ), base AS ( SELECT o.id AS order_id, o.placed_at, s.carrier, s.delivered_at FROM orders o JOIN fulfillments f ON f.order_id = o.id JOIN shipments s ON s.fulfillment_id = f.id JOIN order_fulfillment_counts ofc ON ofc.order_id = o.id JOIN fulfillment_shipment_counts fsc ON fsc.fulfillment_id = f.id WHERE o.status = 'fulfilled' AND o.placed_at >= DATE '2025-01-01' AND o.placed_at < DATE '2026-01-01' AND ofc.cnt = 1 AND fsc.cnt = 1 AND s.delivered_at IS NOT NULL ), scored AS ( SELECT order_id, CASE WHEN carrier IN ('Albion Parcel','Landfall Freight','Lowlands Express') THEN 'Weak three' ELSE 'All other carriers' END AS carrier_group, (delivered_at::date - placed_at::date) AS delivery_days FROM base ) SELECT carrier_group, COUNT(*) AS orders_fully_delivered, ROUND(AVG(delivery_days)::numeric, 2) AS avg_delivery_days, ROUND(100.0 * SUM(CASE WHEN delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*), 1) AS pct_within_5_days, ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER (), 1) AS share_of_orders_pct FROM scored GROUP BY carrier_group ORDER BY carrier_group ASC
STATUS: COMPILES (dry run on the empty schema, no data read) COLUMNS: carrier_group, orders_fully_delivered, avg_delivery_days, pct_within_5_days, share_of_orders_pct
submitWITH order_fulfillment_counts AS ( SELECT order_id, COUNT(*) AS cnt FROM fulfillments GROUP BY order_id ), fulfillment_shipment_counts AS ( SELECT fulfillment_id, COUNT(*) AS cnt FROM shipments GROUP BY fulfillment_id ), base AS ( SELECT o.id AS order_id, o.placed_at, s.carrier, s.delivered_at FROM orders o JOIN fulfillments f ON f.order_id = o.id JOIN shipments s ON s.fulfillment_id = f.id JOIN order_fulfillment_counts ofc ON ofc.order_id = o.id JOIN fulfillment_shipment_counts fsc ON fsc.fulfillment_id = f.id WHERE o.status = 'fulfilled' AND o.placed_at >= DATE '2025-01-01' AND o.placed_at < DATE '2026-01-01' AND ofc.cnt = 1 AND fsc.cnt = 1 AND s.delivered_at IS NOT NULL ), scored AS ( SELECT order_id, CASE WHEN carrier IN ('Albion Parcel','Landfall Freight','Lowlands Express') THEN 'Weak three' ELSE 'All other carriers' END AS carrier_group, (delivered_at::date - placed_at::date) AS delivery_days FROM base ) SELECT carrier_group, COUNT(*) AS orders_fully_delivered, ROUND(AVG(delivery_days)::numeric, 2) AS avg_delivery_days, ROUND(100.0 * SUM(CASE WHEN delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*), 1) AS pct_within_5_days, ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER (), 1) AS share_of_orders_pct FROM scored GROUP BY carrier_group ORDER BY carrier_group ASC
Submitted to tonight's batch. Your work on this request is done.