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
Posted Friday, March 21, 2014 2:46 PM


Group: General Forum Members
Last Login: Today @ 9:14 AM
Points: 460, Visits: 499

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 @ 5:56 PM
Points: 3,545, Visits: 7,651
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.
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?

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



Group: General Forum Members
Last Login: Today @ 3:34 PM
Points: 15,661, Visits: 28,051
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
SQL Server Execution Plans

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

Add to briefcase

Permissions Expand / Collapse