Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. What is an execution plan?

SQL · Query Optimization

What is an execution plan?

Hardsql-31
execution planexplainoptimization

Question

What is an execution plan?

Solution

An execution plan shows how the database intends to execute your query.

You can inspect it using:

EXPLAIN

Some databases support:

EXPLAIN ANALYZE

EXPLAIN shows the planned operations.

EXPLAIN ANALYZE runs the query and reports real runtime stats (on engines that support it).

Look for things like:

  • Table scans
  • Index scans
  • Join methods
  • Estimated vs actual rows
  • Sort operations
  • Expensive operations

🎯 Put this concept into practice

Solidify this answer with real hands-on interview drills in the browser studio.

Open related drill →
PreviousNext