PrepZone Logo
PrepZone
Back to Database

Database · Hard

How do you optimize a slow SQL query? What does EXPLAIN / EXPLAIN ANALYZE tell you?

DatabasePerformanceStaffSQL

Answer preview

Optimising a slow query is a measure → read the plan → fix the root cause → verify loop. EXPLAIN shows the plan the optimiser would run; EXPLAIN ANALYZE actually runs it and reports real timings, row counts, and buffer hits.…