Query Store architecture
Query Store is integrated with the query processor in the database engine. A simplified Query Store architecture in SQL Server 2017 is shown in the following figure:
Query Store architecture
Query Store actually has three stores:
- Query and Plan Store: This stores information about executed queries and execution plans used for their execution
- Runtime Statistics store: This store holds aggregated execution parameters (execution time, logical reads, and so on) for executed queries within a specified time
- Wait Stats Store: This store persists wait statistics information
All three stores have instances in memory and persisted representation through disk tables. Due to performance reasons, captured info is not immediately written to disk; rather it is written asynchronously. Query Store physically stores this info into the database primary file group.
When a query is submitted to the database engine and Query Store is enabled for the database, during query compilation, Query...