This article describes how to recompile a stored procedure in SQL Server by using Transact-SQL. There are three ways to do this: WITH RECOMPILE option in the procedure definition or when the procedure is called, the RECOMPILE query hint on individual statements, or by ...
在SQL Server 创建或修改「存储过程(stored procedure)」时,可加上 WITH RECOMPILE 选项,但多数文档或书籍都写得语焉不详,或只解释为「每次执行此存储过程时,都要重新编译」。事实上,是指执行此一存储过程时,要强制重新产生「执行计划(execution plan)」,而不要从「缓存(cache)」去取得旧的「执行计划」。 SQL ...
In SQL Server, a recompile is a process where the query optimizer generates a new execution plan for a stored procedure or a batch of SQL statements. This article explains the concept of recompilation in SQL Server, when it is necessary, and how to use it effectively in your database app...
Applies to: SQL Server Azure SQL Database Azure SQL Managed InstanceCauses stored procedures, triggers, and user-defined functions to be recompiled the next time that they're run. It does this by dropping the existing plan from the procedure cache, forcing a new plan to be created the...
简介:原文:Stored Procedure 里的 WITH RECOMPILE 到底是干麻的?在 SQL Server 创建或修改「存储过程(stored procedure)」时,可加上 WITH RECOMPILE 选项,但多数文档或书籍都写得语焉不详,或只解释为「每次执行此存储过程时,都要重新编译」。 原文:Stored Procedure 里的 WITH RECOMPILE 到底是干麻的?
Applies to:SQL ServerAzure SQL DatabaseAzure SQL Managed Instance The SP:Recompile event class indicates that a stored procedure, trigger, or user-defined function has been recompiled. Recompilations reported by this event class occur at the statement level. ...
SQL Server Azure SQL Database Azure SQL Managed Instance Causes stored procedures, triggers, and user-defined functions to be recompiled the next time that they're run. It does this by dropping the existing plan from the procedure cache, forcing a new plan to be created the next time that...
Focus on the reuse of saved execution plans for stored procedures; Use of the WITH RECOMPILE option, which tells SQL Server to rebuild the plan each time the procedure is called; Solution for allowing only partial recompilation.Delaney, Kalen...
You can use profiler to watch recompiles. When you choose event, make sure you choose “SQL:StmtRecompile” event (see below). When you run your stored procedure. You will see “SQL:StmtRecompile” event as shown below if that statement gets recompiled. ...
Offset int Starting offset of the statement within the stored procedure or batch that caused recompilation. 61 Yes RequestID int ID of the request containing the statement. 49 Yes ServerName nvarchar Name of the SQL Server being traced. 26 No SessionLoginName...