What are some scenarios (in SQL Server) in which a full table scan is better than an index scan?
|
migrated from stackoverflow.com Jan 26 '12 at 14:33
|
When the
The 2nd case needs qualifying
Finally
|
|||
|
|
|
If the table
|
|||
|
|
|
When selectivity of records is very high full table scan is always better than going through index scan. http://www.techipost.com/single-index-versus-full-table-scan/ Edit by gbn: Example, the optimiser may decide that it's easier to scan the table/clustered index if it would require many key lookups (eg non-clustered index to clustered indexs for non-key data). Or you don't have many distinct values in the indexed columns |
||||
|
|
Better in what way? The optimizer may pick a table scan if an index is not covering, because an index scan would still have to be augmented with a bookmark lookup. In those cases, a poorly indexed table is no better than an unindexed table. http://www.sqlservercentral.com/articles/Performance+Tuning/bookmarklookups/1899/ |
|||
|
|