Deepak Nayak
what is query optimization
By Deepak Nayak in SQL Server on Aug 28 2011
  • Tulasi
    Oct, 2011 14

    Optimization Tips:


    •  Use views and stored procedures instead of heavy-duty queries.
    • Try to use constraints instead of triggers, whenever possible.
    • Use table variables instead of temporary tables.
    • Try to use UNION ALL statement instead of UNION, whenever possible.
    • Try to avoid using the DISTINCT clause, whenever possible.
    • Try to avoid using SQL Server cursors, whenever possible.
    • Try to avoid the HAVING clause, whenever possible.
    • If you need to return the total table's row count, you can use alternative way instead of  SELECT COUNT(*) statement.
    • Include SET NOCOUNT ON statement into your stored procedures to stop the      message indicating the number of rows affected by a T-SQL statement.
    • Use the select statements with TOP keyword or the SET ROWCOUNT statement, if  you need to return only the first n rows.


    • 0
  • Uttam Chaturvedi
    Oct, 2011 13

    Hi Amit,

    It is a technique to tune your query in such a way, so it processes your request faster while interacting with database. 

     

    • 0
  • Amol
    Aug, 2011 29


Most Popular Job Functions


MOST LIKED QUESTIONS