Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Table scan in Query Tuning Expand / Collapse
Author
Message
Posted Friday, March 21, 2014 2:46 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Sunday, July 20, 2014 7:42 PM
Points: 435, Visits: 436
Hi,

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


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 2:20 PM
Points: 3,332, Visits: 7,187
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.
I am a great believer in luck, and I find the harder I work the more I have of it. Stephen Leacock

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


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Today @ 12:12 PM
Points: 15,517, Visits: 27,896
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 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

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

Add to briefcase

Permissions Expand / Collapse