sp_query_store_remove_plan (Transct-SQL)sp_query_store_remove_plan (Transct-SQL)

适用于:Applies to: 是SQL Server 2016 (13.x)SQL Server 2016 (13.x)yesSQL Server 2016 (13.x)SQL Server 2016 (13.x) 及更高版本 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance适用于:Applies to: 是SQL Server 2016 (13.x)SQL Server 2016 (13.x)yesSQL Server 2016 (13.x)SQL Server 2016 (13.x) and later 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance

从查询存储中删除单个计划。Removes a single plan from the query store.

主题链接图标 Transact-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions

语法Syntax

  
sp_query_store_remove_plan [ @plan_id = ] plan_id [;]  

参数Arguments

[ @plan_id = ] plan_id 要删除的查询计划的 id。[ @plan_id = ] plan_id Is the id of the query plan to be removed. plan_idbigint,无默认值。plan_id is a bigint, with no default.

返回代码值Return Code Values

0(成功)或 1(失败)0 (success) or 1 (failure)

备注Remarks

权限Permissions

要求对数据库具有 ALTER 权限。Requires the ALTER permission on the database.

示例Examples

下面的示例返回有关查询存储中的查询的信息。The following example returns information about the queries in the query store.

SELECT Txt.query_text_id, Txt.query_sql_text, Pl.plan_id, Qry.*  
FROM sys.query_store_plan AS Pl  
JOIN sys.query_store_query AS Qry  
    ON Pl.query_id = Qry.query_id  
JOIN sys.query_store_query_text AS Txt  
    ON Qry.query_text_id = Txt.query_text_id ;  

确定要删除的 plan_id 后,请使用下面的示例删除查询计划。After you identify the plan_id that you want to delete, use the following example to delete a query plan.

EXEC sp_query_store_remove_plan 3;  

另请参阅See Also

sp_query_store_force_plan (Transact-sql) sp_query_store_force_plan (Transact-SQL)
sp_query_store_remove_query (Transact-sql) sp_query_store_remove_query (Transact-SQL)
sp_query_store_unforce_plan (Transact-sql) sp_query_store_unforce_plan (Transact-SQL)
sp_query_store_reset_exec_stats (Transact-sql) sp_query_store_reset_exec_stats (Transact-SQL)
sp_query_store_flush_db (Transact-sql) sp_query_store_flush_db (Transact-SQL)
查询存储目录视图 (Transact-sql) Query Store Catalog Views (Transact-SQL)
使用查询存储来监视性能Monitoring Performance By Using the Query Store