Preview
We're still working on this feature, but we'd love for you to try it out!
This feature is currently provided as part of a preview pursuant to our pre-release policies.
You can view query-level analysis to monitor your SQL queries within your MSSQL database to assess their performance and impact. This feature provides insights into execution times, resource consumption, and potential bottlenecks, enabling you to optimize database operations. For more information, refer Query-Level Analysis.

Prerequisites:
- Microsoft SQL Server supports 2017, 2019, or 2022.
- DB user should be a member of the sysadmin fixed server role or have the
VIEW SERVER STATE
permission.
To enable the query level monitoring feature, follow these steps:
To Enable SQL Server and Windows Authentication mode
Enable the login on the SQL Server and Windows Authentication mode. For more information, refer Microsoft change authentication mode documentation.
To Enable TCP
- Ensure TCP is enabled for remote access on your instance using the documentation
- Check firewall settings:
- Ensure that your firewall allows traffic on port
1433
. This is the listening port for Microsoft SQL Server:- Open Windows Defender Firewall with Advanced Security.
- In the left menu, click Inbound Rules.
- Find any rule for SQL Server (typically named SQL Server (TCP-In) or SQL Server TCP 1433).
- If a rule doesn't exist, create a new rule to allow TCP traffic on port 1433.
To Enable the query store
Run the following command
ALTER DATABASE DATABASE_NAME SET QUERY_STORE = ON ( QUERY_CAPTURE_MODE = ALL, DATA_FLUSH_INTERVAL_SECONDS = 900 )
Run the below query to confirm if the query store is enabled
If the output of the query is 1 then we can assume the query store is enabled.
SELECT is_query_store_on FROM sys.databases where physical_database_name = DATABASE_NAME
To Integrate MSSQL agent
Integrate MSSQL agent using this guide.
To Configure the MSSQL integration to enable query performance monitoring
To change the directory to the integration configuration folder, run:
bash$cd "C:\Program Files\New Relic\newrelic-infra\integrations.d\"Edit the
mssql-config.yml
file with the following configuration:
ENABLE_QUERY_MONITORING
- Enable query performance monitoring - Defaults tofalse
.QUERY_MONITORING_RESPONSE_TIME_THRESHOLD
- Set the threshold for query response time in ms to retrieve individual query performance metrics. TheDefaults
is set to500 ms
.QUERY_MONITORING_COUNT_THRESHOLD
- The number of records for each query performance metrics. TheDefaults
is set to20
.integrations:- name: nri-mssqlenv:HOSTNAME: localhostPORT: 1433USERNAME: USERNAMEPASSWORD: PASSWORDENABLE_SSL: trueTRUST_SERVER_CERTIFICATE: true# Enable collection of detailed query performance metrics.ENABLE_QUERY_MONITORING: true# Threshold in milliseconds for query response time. If response time exceeds this threshold, the query will be considered slow.QUERY_MONITORING_RESPONSE_TIME_THRESHOLD: 500# Maximum number of queries returned in query analysis results.QUERY_MONITORING_COUNT_THRESHOLD: 20# Interval in seconds for fetching grouped slow queries; Should always be same as mysql-config interval.QUERY_MONITORING_FETCH_INTERVAL: 15interval: 15slabels:environment: productioninventory_source: config/mssql
Find your data
You can use our prebuilt dashboard template to monitor your MSSQL metrics. Follow these steps to use our prebuilt dashboard template:
- From one.newrelic.com, go to the + Integrations & Agents page.
- Click Dashboards
- In the search bar, type
MSSQL On-Host Integration
- The MSSQL dashboard appears. Click it to install.