Single database index cuts page load time from 78 seconds to 2 seconds
A workplace learning platform's assessment details page was taking 78 seconds to load for a large customer, rendering it effectively unusable. The bottleneck was a SQL query on a table with roughly 700,000 rows, where one customer had around 20,000 attempts logged for a single assessment. Although the table already had four indexes, none covered all three filter conditions simultaneously, forcing MySQL to perform 20,000 random row lookups and then sort a temporary table for grouping. Engineers resolved the issue by adding a single six-column covering index ordered to match the query's equality filters, aggregation columns, and group-by field. The fix reduced load time to approximately 2 seconds and was deployed against the live table using a non-locking index build method.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in