sp_query_store_reset_exec_stats (Transact-sql) sp_query_store_reset_exec_stats (Transact-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

从查询存储中清除特定查询计划的运行时统计信息。Clears the runtime stats for a specific query plan from the query store.

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

语法Syntax

  
sp_query_store_reset_exec_stats [ @plan_id = ] plan_id [;]  

参数Arguments

[ @plan_id = ] plan_id 要清除的查询计划的 id。[ @plan_id = ] plan_id Is the id of the query plan to being cleared. 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 clear the statistics, use the following example to delete the execution stats for a specific query plan. 此示例将删除计划号3的执行统计信息。This example deletes the execution stats for plan number 3.

EXEC sp_query_store_reset_exec_stats 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_remove_plan (Transct-SQL) sp_query_store_remove_plan (Transct-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