• /
  • EnglishEspañol日本語한국어Português
  • Log inStart now

Microsoft SQL Server's integration query level monitoring

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.

Query Performance monitoring

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 TCP

  1. Ensure TCP is enabled for remote access on your instance using the documentation
  2. 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

  1. To change the directory to the integration configuration folder, run:

    bash
    $
    cd "C:\Program Files\New Relic\newrelic-infra\integrations.d\"
  2. Edit the mssql-config.yml file with the following configuration:

  • ENABLE_QUERY_MONITORING - Enable query performance monitoring - Defaults to false.

  • QUERY_MONITORING_RESPONSE_TIME_THRESHOLD - Set the threshold for query response time in ms to retrieve individual query performance metrics. The Defaults is set to 500 ms.

  • QUERY_MONITORING_COUNT_THRESHOLD - The number of records for each query performance metrics. The Defaults is set to 20.

    integrations:
    - name: nri-mssql
    env:
    HOSTNAME: localhost
    PORT: 1433
    USERNAME: USERNAME
    PASSWORD: PASSWORD
    ENABLE_SSL: true
    TRUST_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: 15
    interval: 15s
    labels:
    environment: production
    inventory_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:

  1. From one.newrelic.com, go to the + Integrations & Agents page.
  2. Click Dashboards
  3. In the search bar, type MSSQL On-Host Integration
  4. The MSSQL dashboard appears. Click it to install.

Metrics collected by Integration

Copyright © 2025 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.