Proper Database Indexing & Relationships
Eliminate N+1 query storms and unindexed table scans
Legacy apps slow down because nobody added composite indexes as tables grew from 1,000 to 500,000 rows. I map proper foreign keys, add multi-column B-Tree indexes, rewrite inefficient nested SQL loops into eager queries, and configure connection pools.