Skip to main content
3 of 7
added 139 characters in body
cao
  • 143
  • 1
  • 5

SQL Server - Prevent Clustered Index Scan on a specific table

My database contains a specific table that is quite large (250+M rows, 100+GB data space).

Generating a clustered index scan on this table is always a bad idea.

This table has multiple indexes and we never run a query on this table without specifying predicates on indexed columns.

Since we migrated to SQL Server 2016 and activated the new cardinality estimator, we have experienced random query plan degradations. Queries that would run in a few seconds randomly start to timeout after multiple dozens of minutes.

Of course, I can easily solve this issue for one specific query by adding hints, but I have too many queries in my applications to broadly apply this solution.

Is there a way to globally prevent SQL Server from generating Clustered Index Scan on this table?

I uploaded query plans for a simple query without hint and with hint.

cao
  • 143
  • 1
  • 5