Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Table scan in Query Tuning Expand / Collapse
Posted Friday, March 21, 2014 2:46 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, October 18, 2016 4:44 AM
Points: 1,237, Visits: 2,026

I am doing sp tuning. It has several lines. SO I divided into several small queries and executed individually and check the execution plans. In one small query, I found table scan is happening. That query is basically retrieving all columns from a table but the table doesn't have any pk or Indexes. So is it better to create non-clustered index to remove table sca
Post #1553671
Posted Friday, March 21, 2014 2:51 PM



Group: General Forum Members
Last Login: 2 days ago @ 5:53 PM
Points: 7,951, Visits: 17,213
It depends, I would add a clustered index before thinking about a non-clustered one. It depends as well on the size of the table and the columns and rows used (sometimes a table scan is exactly what you need).

Luis C.
General Disclaimer:
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

How to post data/code on a forum to get the best help: Option 1 / Option 2
Post #1553673
Posted Friday, March 21, 2014 4:08 PM



Group: General Forum Members
Last Login: Yesterday @ 5:37 AM
Points: 17,064, Visits: 31,954
Yeah, I'm with Luis. Most tables should have clustered indexes. Since it stores the data, it should generally be the primary path to the data. That's not necessarily the primary key, but it frequently is.

"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of:
SQL Server Query Performance Tuning
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1553698
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse