- Create index on any key column such as foreign key.
- SET Transaction Isolation Level Read Uncommited at the top of SP
- Use transaction when appropriate
- Avoid temporary table if possible.
- Always use profiling before and after of each change
- Look for every possible way to reduce no of round trips to server
- Avoid Index and join hints
- Avoid functions in where clause
- Every SQL query is broken down in to series of execution steps called as operators. Each operator performs basic operations like insertion, search, scan, updating, aggregation etc. There are 2 kinds of operators Logical operators and physical operators.
- Creating covering index instead of Composite NCI
- Unique column and preferred data types
- The execution plan describes the sequence of operations, physical and logical, that SQL Server will perform in order to fulfill the query and produce the desired resultset.
- Use SP instead of separate statements
- Do not use * operators
- Never use Computed by, cross join and cross join
- Never use LIKE operator when there is an exact match
- Make use of variables
- Use two part naming conventions
- Partition table and indexes
- Use union all instead of union
- Check out slow running query using query optimizer
- Use SQL profiler for trace files and DTA for Advise for better performance
SSIS, SSAS, SSRS, T-SQL, Optimization, DTS, ETL strategy ,ETL packages, Troubleshooting, Data Modeling, Dimensional Modeling, Data Warehouse Design, Cube Design, OLTP, OLAP, XML
Tuesday, October 25, 2011
T-SQL Queries Optimization
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment