--- title: "sp_query_store_flush_db (Transact-SQL) | Microsoft Docs" ms.custom: "" ms.date: "03/24/2017" ms.prod: sql ms.prod_service: "database-engine, sql-database" ms.reviewer: "" ms.technology: system-objects ms.topic: "language-reference" f1_keywords: - "sp_query_store_flush_db_TSQL" - "sys.sp_query_store_flush_db_TSQL" - "sp_query_store_flush_db" - "sys.sp_query_store_flush_db" dev_langs: - "TSQL" helpviewer_keywords: - "sys.sp_query_store_flush_db" - "sp_query_store_flush_db" ms.assetid: 580c03ae-57fc-4562-a6bb-5ec89521e38c author: stevestein ms.author: sstein monikerRange: "=azuresqldb-current||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current" --- # sp_query_store_flush_db (Transact-SQL) [!INCLUDE[tsql-appliesto-ss2016-asdb-xxxx-xxx-md](../../includes/tsql-appliesto-ss2016-asdb-xxxx-xxx-md.md)] Flushes the in-memory portion of the Query Store data to disk. ![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md) ## Syntax ``` sp_query_store_flush_db [;] ``` ## Return Code Values 0 (success) or 1 (failure) ## Remarks ## Permissions Requires the **ALTER** permission on the database. ## Examples The following example flushes the in-memory portion of the Query Store data to disk. ``` EXEC sp_query_store_flush_db; ``` ## See Also [sp_query_store_force_plan (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-query-store-force-plan-transact-sql.md) [sp_query_store_remove_query (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-query-store-remove-query-transact-sql.md) [sp_query_store_unforce_plan (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-query-store-unforce-plan-transact-sql.md) [sp_query_store_reset_exec_stats (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-query-store-reset-exec-stats-transact-sql.md) [sp_query_store_remove_plan (Transct-SQL)](../../relational-databases/system-stored-procedures/sp-query-store-remove-plan-transct-sql.md) [sp_query_store_reset_exec_stats (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-query-store-reset-exec-stats-transact-sql.md) [Query Store Catalog Views (Transact-SQL)](../../relational-databases/system-catalog-views/query-store-catalog-views-transact-sql.md) [Monitoring Performance By Using the Query Store](../../relational-databases/performance/monitoring-performance-by-using-the-query-store.md)