COMPUTER ENGINEER

Jump to examples
Blog
SQL Server / T-SQL6 min study
49/ 65

Indexes and performance

Reading execution plans

Compare estimated and actual rows.

UnderstandStudy an examplePractise

Understand the concept

An estimated plan shows proposed operators without execution. An actual plan adds runtime observations; its cost percentages remain model estimates rather than elapsed-time percentages. Executing a query still performs its writes and consumes resources.

Start with actual versus estimated rows, spill warnings, sorts, lookups and join points. Do not judge a plan by one icon. If many rows flow through operators to produce few results, inspect filters and grain. In SSMS, enable the actual plan with Ctrl+M, execute a SELECT and inspect the Execution Plan tab. This tiny dataset teaches reading, not production benchmarking.

WHEN TO USE IT

Optimise based on evidence.

COMMON PITFALL

Reading estimated cost percentages as elapsed time.

01 / PRACTICE

One topic. Three levels of depth.

T-SQL / SQL Server 2019+
SELECT ProductName FROM lab.Product WHERE ProductId = 1;

Inspect a simple key lookup query’s plan.

This page does not execute SQL. Practise in the downloadable SqlStudioLab using SSMS. Before rerunning temporary-table examples, remove only the relevant #table. Views, procedures and functions create persistent lab objects; never use a production connection.

02 / YOUR TURN

Try it yourself first.

Inspect the actual plan for products sorted by price.

Show the solution and explanation
Worked solution
SELECT ProductId, ProductName, Price FROM lab.Product ORDER BY Price DESC, ProductId;

Evaluate sorting against existing indexes. The browser does not execute this plan.