Azure SQL 服务器:如果设置了存储过程选项(保留计划),则会创建多个执行计划
Azure SQL Server : There are multiple execution plans created if the Stored Procedure Option (Keep Plan) is set
我正在使用 Azure SQL 服务器数据库。
似乎 Azure SQL 服务器数据库创建了多个执行计划,无论是否选择了选项(保留计划)。
CREATE PROCEDURE SelectAllCustomers
@varX DataType-Y...
AS
SELECT .....
Where ....
Order By ....
Option (Keep Plan)
GO;
根据定义:
KEEP PLAN
Forces the query optimizer to relax the estimated recompile threshold for a query. The estimated recompile threshold is the point at which a query is automatically recompiled when the estimated number of indexed column changes have been made to a table by running UPDATE, DELETE, or INSERT statements. Specifying KEEP PLAN makes sure that a query will not be recompiled as frequently when there are multiple updates to a table.
创建多个执行计划的原因是什么?选择 Option (Keep Plan) 可以吗?
您问题中的屏幕图像来自查询存储。此 QS 报告显示计划的历史记录,而不仅仅是当前缓存的计划,因此您可能会看到同一查询的多个计划。
我正在使用 Azure SQL 服务器数据库。
似乎 Azure SQL 服务器数据库创建了多个执行计划,无论是否选择了选项(保留计划)。
CREATE PROCEDURE SelectAllCustomers
@varX DataType-Y...
AS
SELECT .....
Where ....
Order By ....
Option (Keep Plan)
GO;
根据定义:
KEEP PLAN Forces the query optimizer to relax the estimated recompile threshold for a query. The estimated recompile threshold is the point at which a query is automatically recompiled when the estimated number of indexed column changes have been made to a table by running UPDATE, DELETE, or INSERT statements. Specifying KEEP PLAN makes sure that a query will not be recompiled as frequently when there are multiple updates to a table.
创建多个执行计划的原因是什么?选择 Option (Keep Plan) 可以吗?
您问题中的屏幕图像来自查询存储。此 QS 报告显示计划的历史记录,而不仅仅是当前缓存的计划,因此您可能会看到同一查询的多个计划。