In SQL Server, what is the purpose of the OPTION (RECOMPILE) query hint?

Advanced SQL Developer Hard

Advanced SQL Developer — Hard

In SQL Server, what is the purpose of the OPTION (RECOMPILE) query hint?

Key points

  • OPTION (RECOMPILE) generates a new execution plan at runtime
  • It uses actual parameter values to avoid parameter sniffing issues
  • Helps prevent using a cached plan with incorrect parameters

Ready to go further?

Related questions