How do you check how a query runs?

SQL indexes, transactions and performance · Freshers and experienced

Model answer

Use EXPLAIN (or EXPLAIN ANALYZE in PostgreSQL, which also runs the query) to see the plan: scans, index use, join types and estimated and actual rows. Look for full table scans on big tables, large row estimate mismatches, and expensive sorts.

Learn this topic

Indexes and Faster Queries: EXPLAIN for Beginners in the course SQL for Beginners: Learn Databases Step by Step.

Sign in to add your own answer.

More questions