Skillsline: Optimizing a Database Query, 12.41s to 2.451s
A loop of many queries became one aggregating query. Execution fell from 12.41 to 2.451 seconds, weekly CPU load from 82.2% to 2.75%.
Project context
Backend and frontend work on a training platform with partner-service integrations, with a focus on database and application performance.
My engineering contribution
- Replaced a loop issuing multiple database queries with one aggregating query: execution dropped from 12.41 to 2.451 seconds, and memory use fell by 1.5 GB.
- Reduced weekly average CPU load from 82.2% to 2.75% and identified missing search indexes.
- Reduced the average execution time of a critical operation from 23,937 ms to 48 ms and cut an API response from 912 KB to 2.1 KB.
Results & scope
Targeted changes to query patterns, data retrieval and application bottlenecks produced measurable improvements. Each figure refers to its specific operation or measurement, not a whole-platform speed multiplier.
- Database operation
- 12.41 → 2.451 s
- Weekly average CPU load
- 82.2% → 2.75%
- API response size
- 912 → 2.1 KB
Technologies used
- Strapi
- Vue.js
- MySQL
- Node.js
- Laravel
- AWS
- REST API
- Linux