Query Store architecture
Query Store is integrated with the query processor of the database engine. The simplified architecture diagram is shown in the following diagram:
Figure 9.2: Query Store architecture
Query Store actually has two stores:
Query and Plan Store: Stored 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
Both stores have instances in memory and persisted representation through disk tables. Due to performance reasons, captured info is not immediately written to disk, it is rather 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 Store captures information about the query and execution plan. This is then sent...