Capturing the Query info

To simulate a database workload, you will execute one simple query. Ensure that the database is in compatibility mode 110, and that Query Store is empty, in order to track your queries easily:

ALTER DATABASE WideWorldImporters SET COMPATIBILITY_LEVEL = 110;ALTER DATABASE WideWorldImporters SET QUERY_STORE CLEAR; 

Run this code to execute one statement 100 times, as shown in the following command:

SET NOCOUNT ON;SELECT * FROM Sales.Orders oINNER JOIN Sales.OrderLines ol ON o.OrderID = ol.OrderIDWHERE SalespersonPersonID IN (0, 897);GO 100 

The previous query returns no rows; there are no orders in the Sales.Orders table handled by sales persons with given IDs. After executing this single query 100 times, you can check ...

Get SQL Server 2017 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.