Query Store in action

In this section, you will see how Query Store collects information about queries and query plans and how it can identify and fix regressed queries. It will be demonstrated how Query Store supports and facilitates an upgrade to SQL Server 2016.

First, you will create a new database with a single table and populate it with two million rows. This database will simulate a database that is created and used in SQL Server 2012 and that you restored in SQL Server 2016 but left in the old compatibility mode. Use the following code to accomplish this task:

IF DB_ID('Mila') IS NULL CREATE DATABASE Mila; GO USE Mila; GO --help function GetNums created by Itzik Ben-Gan (http://tsql.solidq.com) CREATE OR ALTER FUNCTION dbo.GetNums(@n AS ...

Get SQL Server 2016 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.