Hi, everyone.
I have read a lot of topics about execution plan for query, but I got little.
Please give me some help with examples for comparing different select statements to find the best efficient select statement.
Thank you very much.Avoid table scans like the plague. Use "where" clauses whenever possible to reduce the amount of raw data you're working with. Make sure you have proper indexing. Also, read this:
http://www.databasejournal.com/features/mssql/article.php/1437391|||hi,
you can check this web site : http://www.sqlservercentral.com/columnists/rmarda/performanceaddinghints_printversion.asp
it's under (Using The Index Hint) section
good luck|||A simple "first pass" that can sometimes make it clear which statement is a dog and which is good is to:
Pop all your select statements in a single window in QA. Hit Ctrl + K. Hit F5. Look at the query plan window.
You will see a plan for each statement including an "overall cost" for each statement. Sometimes this shows you clearly which is better\ worse without a need to look much further.
For more detailed optimisation you need to look at the individual components of the plans, run things like SET STATISTICS IO ON, SET STATISTICS TIME ON, look at Profiler and so on.|||IMHO you should avoid index hints until you are much more comfortable with optimisation and query tuning.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment