Solve “Deduplicate events with ROW_NUMBER”

Free. Runs in your browser, no install.

SQL · Query Optimization

What is an execution plan?

Hardexecution planexplainoptimization

Interview question

What is an execution plan?

How to answer

The short answer

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

You can inspect it using:

SQL
EXPLAIN

Some databases support:

SQL
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

Lock it in with a real drill

You remember an answer longer once you have used it. Try a hands-on problem on this concept.

Open related drill