Code Analysis

PE006

TABLE HINT is used

It is not recommended to use table hints.

Table hints enable you to control how the optimizer uses a table, when generating an execution plan for the query to which the table hint is applied. For example, you can force the use of a Table Scan for that query, or specify which index you want the optimizer to use (see PE005), or specify that the optimizer should not acquire shared-read locks when executing the query.

As with the query and join hints, using a table hint circumvents the normal optimizer processes and can lead to serious performance issues. Further, since table hints can affect locking strategies, they could possibly affect data integrity leading to incorrect or lost data. They should be used only as a last resort by experienced developers and database administrators, and only if you are certain of the consequences for performance and scalability. You will also need a maintenance plan to identify and re-test all hints in response to changes in the data distribution, or an upgrade to a new SQL Server version, or application of a new service pack.

For more information on the dangers of using hints, see SQL Prompt Code Analysis: A Hint is Used (PE004-7).



Didn't find what you were looking for?