Share via


Query Statistics - List By Query

Lists a query's statistics.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/topQueries/{queryId}/statistics?api-version=2014-04-01

URI Parameters

Name In Required Type Description
databaseName
path True

string

The name of the database.

queryId
path True

string

The id of the query

resourceGroupName
path True

string

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

serverName
path True

string

The name of the server.

subscriptionId
path True

string

The subscription ID that identifies an Azure subscription.

api-version
query True

string

The API version to use for the request.

Responses

Name Type Description
200 OK

QueryStatisticListResult

OK

Examples

Get a query

Sample request

GET https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/databases/db1/topQueries/19/statistics?api-version=2014-04-01

Sample response

{
  "value": [
    {
      "queryId": "19",
      "intervals": [
        {
          "intervalStartTime": "2017-07-11T16:00:00",
          "executionCount": 12,
          "metrics": [
            {
              "name": "cpu",
              "displayName": "Cpu",
              "unit": "percentage",
              "value": 0.000763888888888889
            },
            {
              "name": "io",
              "displayName": "Physical Io Reads",
              "unit": "percentage",
              "value": 0
            },
            {
              "name": "logIo",
              "displayName": "Log Writes",
              "unit": "percentage",
              "value": 0
            },
            {
              "name": "memory",
              "displayName": "Memory consumption",
              "unit": "KB",
              "value": 0
            },
            {
              "name": "duration",
              "displayName": "Query duration",
              "unit": "microseconds",
              "value": 3308
            }
          ]
        }
      ]
    }
  ]
}

Definitions

Name Description
QueryInterval

A database query.

QueryMetric

A database query.

QueryMetricUnit

The unit of measurement

QueryStatistic

A database query.

QueryStatisticListResult

Represents the response to a get query request.

QueryInterval

A database query.

Name Type Description
executionCount

number (int32)

The number of times the query was executed during this interval.

intervalStartTime

string (date-time)

The start time of the measurement interval (ISO8601 format).

metrics

QueryMetric[]

The list of query metrics during this interval.

QueryMetric

A database query.

Name Type Description
displayName

string

The name of the metric for display in user interface

name

string

The name of the metric

unit

QueryMetricUnit

The unit of measurement

value

number (double)

The measured value

QueryMetricUnit

The unit of measurement

Value Description
percentage
KB
microseconds

QueryStatistic

A database query.

Name Type Description
intervals

QueryInterval[]

The list of query intervals.

queryId

string

The id of the query

QueryStatisticListResult

Represents the response to a get query request.

Name Type Description
value

QueryStatistic[]

The query.