MySQL add an index and check it with EXPLAIN
SQL Dasun Kalupahana 90 views
ALTER TABLE orders ADD INDEX idx_user_created (user_id, created_at);
EXPLAIN
SELECT * FROM orders
WHERE user_id = 42
ORDER BY created_at DESC
LIMIT 20;
Adds an index to speed up a slow WHERE clause, then uses EXPLAIN to confirm the query uses it. Check that key is set and rows is small.
Learn more on the blog
MySQL
PostgreSQL vs MySQL Performance: Real Benchmarks Compared
Last updated: 7 November 2026. See the update log at the end."Which...
8 min read
PHP
How to Detect and Fix PHP Memory Leaks
Last updated: 5 November 2026. See the update log at the end.In...
9 min read
Docker
Docker Build Too Slow? 10 Ways to Speed It Up
A slow Docker build usually has one of a few causes: you...
8 min read