Narrative

Full Table Scans → Instant Page Loads

Certain pages — attendance aggregation, fee lookups — were painfully slow. Users were waiting 10+ seconds for pages that should load instantly.

PostgreSQLQuery OptimizationPerformance

What Was Broken

How It Was Built

I ran EXPLAIN ANALYZE on the slow queries. Classic problem — full table scans on large tables because the right indexes didn't exist. Attendance aggregation was scanning every row to compute totals that could have been pre-computed. I added composite indexes on the columns being filtered and sorted. For aggregation queries that ran frequently, I introduced materialized views — pre-compute the result, refresh on a schedule, serve it instantly.

What Changed

Pages went from 10+ second loads to near-instant. On the low-spec machines the college actually uses, that difference is the difference between a usable system and one people abandon.