Skip to content
Founding beta: 7 of 50 free spots leftClaim yours

The 'orders of the day' query reads the whole table

Bug huntEasyPython · PostgresDatabasePerformance20 min

OPS-1182: "Orders of the day" page is slow

Reported by: Callum Reyes (Support lead, Moss Wholesale) · Priority: Medium · Component: Back office

Symptom

Opening "Orders of the day" in the back office takes about 2 seconds, and a few seconds more when several of us use it at once. In spring it was instant. The slow part is the one query behind the page (plan from production attached).

Steps to reproduce

Run the orders-for-a-day query for any recent date. The sample data is tiny, so look at the work the query does (the production plan shows what it looked like on the real table) rather than its time.

Expected

The page returns one day's orders in well under 100 ms on the production table, reading only the part of the table for that day. The rows must stay the same.

Actual

About 1.8 s per call; the plan scans the whole table.

© AICodingRound. Ticket text for practice on this site; see Terms.

How it works

  1. 1Fix the problemin a real codebase.
  2. 2Use your ownAI, or none.
  3. 3Submit, then answera few short questions.
  4. 4Get your gradeand feedback.

Guides that use this problem

All guides

More on SQL practice

View all

Related problems

View all