Friday, November 28, 2008

Query hints in SQL

Query hints, also referred to as optimizer hints, can dramatically affect the execution of a query, its index choices, as well as its locking behavior. In general SQL Server 2000, will choose the query plan that provides the best possible performance, so using optimizer hints should not be exercised "just in case". Instead, it is recommended that you troubleshoot and examine the query execution, then see if you can modify any of your table / index design to optimize the query. Then, as the last resort of a very troubled query, you can evaluate and test using query hints.