USE PLAN query hint in SQL Server 2012 can be used to encourage the Query Optimizer to use the specified XML query plan for processing the query. This option provides more control over influencing the execution of a query than is possible with the other available query hints, such as
LOOP JOIN, and
KEEP PLAN. None of these options individually are powerful enough to influence the Query Optimizer to consistently choose a particular query plan, especially when the referenced table row counts, statistics, indexes, and other attributes of the environment change.
USE PLAN query hint is specified in the
OPTION clause, and you provide it with a query plan in XML format. Listing 31.7 provides an example ...