One of the (not-so hidden) gems in SQL Server is the availability of the Query Store. Unfortunately you need SQL Server 2016 or higher to be able to use this feature.
The good news is that there is an alternative for older SQL Server versions; OpenQueryStore.
OpenQueryStore (OQS) is a collection of scripts that add Query Store like functionality to pre-SQL Server 2016 Instances!
OQS is being built from the ground up to allow all versions and editions of SQL Server from 2005 up to and including 2014 to have a Query Store like functionality. The data collection, retention and cleanup will be easily configurable to allow for complete control of the OQS data storage.
Installation
-
Download the latest release of Open Query Store from the releases page and unzip the file.
-
Open a PowerShell console and navigate to the location of the unzipped files. Copying the command below change the values of
<Instance>
,<dbName>
and<path>
and OQS will be installed for you.
.\Install.ps1 -SqlInstance <Instance> -Database <dbName> -OQSMode Centralized -SchedulerType "Service Broker" -CertificateBackupPath "<path>"
Configuration
After the installation is done, you have to enable the data collection by setting the collection_active bit to true in the [oqs].[collection_metadata] table. When enough data is collected you can check the generated data through one of the available reports.
Reports
The OQS Dashboards can be viewed directly from SSMS (v16. or V17.).
- Download the
OpenQueryStoreDashboard.rdl
andOpenQueryStoreWaitStatsDashboard.rdl
files from the GitHub page and store it on a machine with SSMS installed. - Right-click on a user database that has the OQS enabled and select "Reports - Custom Reports".
- Navigate to the location were you stored the .rdl files and open it.