Question 10 of 10Pro Only
A database query is running slowly. How would you diagnose and optimize it?
Sample answer preview
## Step 1: Identify the Slow Query Use query logging or monitoring tools: ```sql -- PostgreSQL: Enable slow query logging SET log_min_duration_statement = 1000; -- Log queries > 1 second -- Or use pg_stat_statements extension SELECT query, calls, mean_time, total_time FROM…
EXPLAINquery optimizationindexingN+1performanceSeq Scan