seniorT-SQL

What is Cardinality Estimation in SQL Server and why does it matter?

Updated May 17, 2026

Short answer

Cardinality estimation predicts the number of rows returned by a query operation.

Deep explanation

SQL Server's Query Optimizer uses cardinality estimation (CE) to decide join types, memory grants, and execution strategies. It relies on statistics, histograms, and assumptions about data distribution. Incorrect CE leads to bad plans like hash joins where nested loops would be better, or excessive memory grants causing spills to tempdb.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More T-SQL interview questions

View all →