SQL Server Performance Tuning Techniques - Set 1

Sunday, March 13, 2011

1. Use actual column names instead of '*' in the queries.
2. HAVING clause is used to filter the rows after all the rows are selected. It is just like a filter. Do not use HAVING clause for any other purposes.
3. Try to minimize number of subqueries in your query
4. Avoid using IN unnecessarily as IN is slowest.
5. IN is efficient when most of the filter criteria is in the sub-query.
6. EXISTS is efficient when most of the filter criteria is in the main query.
7. Use EXISTS instead of DISTINCT when using joins which involves tables having one-to-many relationship.
8. Try to use UNION ALL in place of UNION.
9. To store large binary objects, first place them in the file system and add the file path in the database.
10. Best practices :
a) Use single case for all SQL verbs
b) Begin all SQL verbs on a new line
c) Separate all words with a single space
d) Right or left aligning verbs within the initial SQL verb


1.www.codecollege.NET 2.http://www.interviewsguru.com 3.The Encylopedia of Web Sites 4.Blogging and Earning

0 comments

Post a Comment

LinkWithin

Blog Widget by LinkWithin

Recommended Books