Prevents a plan from being cached. As a procedure option it forces a fresh compile on each call; as a query hint it applies to just one statement, which often cures parameter sensitivity.
Read more: Microsoft Learn
In the Ultra Transcenders books
Each book explains RECOMPILE in context, with comparison tables and the common traps.
Terms in this definition
- State
A parameter in OAuth that carries custom data through the authorisation flow and back, as with the "Support state parameter" option in APIM.
Related terms
- OPTION clause
Placed last in a statement, this clause carries query hints, for instance RECOMPILE, MAXDOP 1 or HASH JOIN, which then govern every operator in that statement.
- Query Store hints
A way to change how a query behaves, with hints such as RECOMPILE or MAXDOP tied to its query_id, while its code stays untouched. Supported from SQL Server 2022, in Azure SQL and in Fabric.