Below are some points to optimize stored procedure in SQL Server
• Use as much as possible WHERE clause filters. Where Clause is the most important part for optimization.
• Select only those fields which really required.
• Joins are expensive in terms of time. Make sure that use all the keys that relate to the tables together and don't join to the unused tables, always try to join on indexed fields. The join type is important as well in (INNER, OUTER).
Asked In: Many Interviews |