QDS_PERSIST_TASK_MAIN_LOOP_SLEEP Wait Type in SQL Server

⏳Part of the SQL Server Wait Types Library, every wait type explained.Related deep dive: IO_COMPLETION Wait TypeRelated pillar: Performance & Troubleshooting

Is It a Problem?

No. It is a Query Store background timer, commonly filtered as benign, and Get Wait Statistics filters it out by default.


What It Means

Microsoft lists it as internal use only, from SQL Server 2014. It is a thread waiting for a timer between operations that persist Query Store metrics to disk. The DATA_FLUSH_INTERVAL_SECONDS option, 900 seconds by default, sets how often captured data is written; on our SQL Server 2025 lab this wait averaged about 60 seconds per wait, so it is not simply the flush interval.


When It Does Matter

It does not. Leave the flush interval alone unless you have a measured reason.

Query Store health has its own witness: sys.database_query_store_options, per database, shows actual_state_desc against desired_state_desc and the size used against max_storage_size_mb. The baseline to monitor is the actual state staying READ_WRITE with headroom under the cap; a store that has flipped to READ_ONLY because it filled up is the real problem. Get Query Store Status reads it for every database.


The QDS Family

These are the Query Store waits. Most are background timers and queues that tick over in every database with Query Store on; two of them can matter. If one is near the top of your waits, read it next to the waits that usually matter.

  • QDS_PERSIST_TASK_MAIN_LOOP_SLEEPPersist timer. The pause between runs that write Query Store data to disk.Usually noise. This page.
  • QDS_ASYNC_QUEUEPersist queue. Access to the queue of Query Store data waiting to be written to disk.Usually noise
  • QDS_CLEANUP_STALE_QUERIES_TASK_MAIN_LOOP_SLEEPCleanup timer. The pause between runs that remove old queries from the store.Usually noise
  • QDS_SHUTDOWN_QUEUEShutdown queue. Documented as internal use only; a background Query Store queue.Usually noise
  • QDS_DYN_VECTORInternal structure. Access to a thread-safe Query Store data structure.Usually noise
  • QDS_STMTNew query tracking. Registering a query Query Store has not seen before.Worth a look when it climbs
  • QDS_LOADDBLoading at startup. Query Store loading its data when a database starts up.Worth a look when it climbs

Where To Go Next

QDS_PERSIST_TASK_MAIN_LOOP_SLEEP is background noise wherever Query Store is on. If you are chasing a real problem, start with the waits that cost you time.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *