InfoQ Homepage News SQL Server 2016: Identify Regressions with Query Store

SQL Server 2016: Identify Regressions with Query Store


For most developers, performance regressions can usually be traced back to a specific event such a major influx of users or a code change. For the database developer, it isn’t always so easy. As indexes are rebuilt and statistics updated, SQL Server may decide to “rewrite” your code by regenerating the execution plan. Without the right backup and production-grade hardware, seeing what changed in the execution plan can be neigh impossible.

At least it was. With SQL Server 2016, Microsoft will start storing historic execution plans using a feature called Query Store. When enabled, the Query Store will log information about each query including:

  • Number of executions
  • Execution time
  • Memory Consumption
  • Logical Reads
  • Logical Writes
  • Physical Reads
  • Number of execution plan changes

To reduce the load on the server, this information is aggregated into fixed windows. If you need more precise data, you should look to Extended Events instead.

The easiest way to use this information is to open the Regressed Queries view.

This tool will allow you to see regressions based on any of the recorded metrics. If you see a regression, you have the option to force SQL Server to use an older execution plan.

Query Store Tuning

Because tracking metrics like this can be expensive, SQL Server allows you to tune the Query Store. Factors you can adjust include the size of the aggregate window in minutes, the max size of the query store in MB, the maximum number of execution plans to store. You can also tell the Query Store to only record queries that meet certain criteria.

Programmatic Access

As with most SQL Server features, all the information you see in the Regressed Queries tool can be accessed directly using a collection of management views.

We need your feedback

How might we improve InfoQ for you

Thank you for being an InfoQ reader.

Each year, we seek feedback from our readers to help us improve InfoQ. Would you mind spending 2 minutes to share your feedback in our short survey? Your feedback will directly help us continually evolve how we support you.

Take the Survey

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p


Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.