Skip to content
Timed challenge

The Report That Never Arrives

The department's nightly attendance export has stopped arriving, and when it did run it crawled. Get the report written again, make its query use an index, and lose no data doing it.
  • Intermediate
  • 20 min
  • Challenge
  • SQL
  • Performance
  • Timed

Overview

The department office gets a CSV of last week's CS204 attendance every morning. This week: nothing. The export script fails, and even before it failed the query behind it read every row of a 200,000-row table.

Repair the export so it writes /var/reports/cs204.csv again, make the database answer its query from an index, and keep every attendance row exactly as it is. No hints — psql, EXPLAIN and the script itself will tell you what you need.

What done looks like

  • Make the report's query use an index
  • Get /usr/local/bin/attendance-report writing its CSV again
  • Change no attendance data while doing it

Before you start

  • Indexes, Transactions & EXPLAIN first, or equivalent PostgreSQL familiarity
  • Timed challenge: failed checks return no hints

Learn the skills first