Skip to main content

Explain Partition Elimination with an example scenario.

Senior MS SQL
Quick Answer Partition elimination is when SQL Server skips partitions that can't contain matching rows. A query filtering WHERE OrderDate BETWEEN '2024-01-01' AND '2024-03-31' on a table partitioned by month only scans Q1 partitions and ignores the rest. This dramatically reduces I/O on large, date-partitioned tables.

Answer

Partition elimination occurs when SQL Server restricts I/O to only those partitions that might contain relevant rows, instead of scanning all partitions.

Example: A table partitioned by OrderDate by month. A query filtered on OrderDate BETWEEN '2024-01-01' AND '2024-01-31' can read only the January partition if:

  • The filter is directly on the partition key.
  • There are no non-SARGable expressions on the partition column.
  • The data types and collation match exactly.

If functions like CONVERT() or different data types are used on the partition column, partition elimination may fail and all partitions may be scanned, losing the performance benefit.

S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice