Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 how to tune the SQL statement

Author  Topic 

hannah00
Starting Member

31 Posts

Posted - 2012-06-07 : 10:45:06
I have a SQL query and I suspect it may need an index b/c the plan showed it took 80% to work on one table.

SQL have Tuning Advisor to do such thing and I don't know how to use it. Can someone show me a white paper or instruction of how tune this SQL?

Thanks

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-06-07 : 10:55:23
Have a lok at the columns being accessed for the large table. Then you have options.
Index on the join columns for that table and include all other columns being used - this will make the index covering.

It may still table scan and even if it doesn't
Can split into two queries (or maybe a subquery) one doing the join to get the clustered PK of rows needed and a second join to get the data. If the PK is not clustered yoou may need to use a clustered index or maybe split the query into batches which use an index.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -