你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Managed Instances - List By Managed Instance

获取托管实例的主要资源消耗查询。

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/topqueries?api-version=2020-08-01-preview
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/topqueries?numberOfQueries={numberOfQueries}&databases={databases}&startTime={startTime}&endTime={endTime}&interval={interval}&aggregationFunction={aggregationFunction}&observationMetric={observationMetric}&api-version=2020-08-01-preview

URI 参数

Name In Required Type Description
managedInstanceName
path True
  • string

托管实例的名称。

resourceGroupName
path True
  • string

包含该资源的资源组名称。 可以从 Azure 资源管理器 API 或门户获取此值。

subscriptionId
path True
  • string

用于标识 Azure 订阅的订阅 ID。

api-version
query True
  • string

要用于请求的 API 版本。

aggregationFunction
query

要使用的聚合函数,默认值为“sum”

databases
query
  • string

要包含在搜索中的数据库的逗号分隔列表。 如果未指定此参数,则包括所有 DB。

endTime
query
  • string

观察到的时间段的结束时间。

interval
query

用于汇总指标值的时间步骤。 默认值为 PT1H

numberOfQueries
query
  • integer
int32

要返回的“排名靠前的查询”数量。 默认值为 5。

observationMetric
query

用于排名排名靠前查询的指标。 默认值为“cpu”

startTime
query
  • string

观察时间段的"开始"菜单时间。

响应

Name Type Description
200 OK

已成功检索托管实例的顶级查询。

Other Status Codes

错误响应: ***

  • 404 SubscriptionDoesNotHaveServer - 找不到请求的服务器

  • 404 ServerNotInSubscriptionResourceGroup - 指定的服务器在指定的资源组和订阅中不存在。

  • 404 ResourceNotFound - 找不到请求的资源。

示例

Obtain list of instance's top resource consuming queries.
Obtain list of instance's top resource consuming queries. Full-blown request and response.
Obtain list of instance's top resource consuming queries. Minimal request and response.

Obtain list of instance's top resource consuming queries.

Sample Request

GET https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/topqueries?interval=PT1H&observationMetric=duration&api-version=2020-08-01-preview

Sample Response

{
  "value": [
    {
      "numberOfQueries": 5,
      "aggregationFunction": "sum",
      "observationMetric": "cpu",
      "intervalType": "P1D",
      "startTime": "03/01/2020 00:00:00",
      "endTime": "03/05/2020 13:00:00",
      "queries": [
        {
          "databaseName": "db1",
          "queryId": "25",
          "intervals": [
            {
              "intervalStartTime": "03/03/2020 00:00:00",
              "executionCount": 1,
              "metrics": [
                {
                  "name": "cpu",
                  "displayName": "Cpu",
                  "unit": "percentage",
                  "value": 0.0015841714409722222
                },
                {
                  "name": "io",
                  "displayName": "Physical Io Reads",
                  "unit": "percentage",
                  "value": 4.340277777777778E-06
                },
                {
                  "name": "logIo",
                  "displayName": "Log Writes",
                  "unit": "percentage",
                  "value": 0
                },
                {
                  "name": "memory",
                  "displayName": "Memory consumption",
                  "unit": "KB",
                  "value": 8336
                },
                {
                  "name": "duration",
                  "displayName": "Query duration",
                  "unit": "microseconds",
                  "value": 11306905
                }
              ]
            }
          ]
        },
        {
          "databaseName": "db1",
          "queryId": "21",
          "intervals": [
            {
              "intervalStartTime": "03/03/2020 00:00:00",
              "executionCount": 1,
              "metrics": [
                {
                  "name": "cpu",
                  "displayName": "Cpu",
                  "unit": "percentage",
                  "value": 0.0009521432291666667
                },
                {
                  "name": "io",
                  "displayName": "Physical Io Reads",
                  "unit": "percentage",
                  "value": 2.3148148148148148E-07
                },
                {
                  "name": "logIo",
                  "displayName": "Log Writes",
                  "unit": "percentage",
                  "value": 0
                },
                {
                  "name": "memory",
                  "displayName": "Memory consumption",
                  "unit": "KB",
                  "value": 1024
                },
                {
                  "name": "duration",
                  "displayName": "Query duration",
                  "unit": "microseconds",
                  "value": 6620020
                }
              ]
            }
          ]
        },
        {
          "databaseName": "db3",
          "queryId": "3",
          "intervals": [
            {
              "intervalStartTime": "03/04/2020 00:00:00",
              "executionCount": 104,
              "metrics": [
                {
                  "name": "cpu",
                  "displayName": "Cpu",
                  "unit": "percentage",
                  "value": 0.0008006611689814815
                },
                {
                  "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": 5543088
                }
              ]
            }
          ]
        },
        {
          "databaseName": "db2",
          "queryId": "3",
          "intervals": [
            {
              "intervalStartTime": "03/03/2020 00:00:00",
              "executionCount": 89,
              "metrics": [
                {
                  "name": "cpu",
                  "displayName": "Cpu",
                  "unit": "percentage",
                  "value": 0.0006882543402777778
                },
                {
                  "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": 4761877
                }
              ]
            }
          ]
        },
        {
          "databaseName": "db3",
          "queryId": "22",
          "intervals": [
            {
              "intervalStartTime": "03/04/2020 00:00:00",
              "executionCount": 1,
              "metrics": [
                {
                  "name": "cpu",
                  "displayName": "Cpu",
                  "unit": "percentage",
                  "value": 0.0006220661168981482
                },
                {
                  "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": 1024
                },
                {
                  "name": "duration",
                  "displayName": "Query duration",
                  "unit": "microseconds",
                  "value": 4454161
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

Obtain list of instance's top resource consuming queries. Full-blown request and response.

Sample Request

GET https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/topqueries?databases=db1,db2&startTime=2020-03-10T12:00:00Z&endTime=2020-03-12T12:00:00Z&interval=P1D&observationMetric=cpu&api-version=2020-08-01-preview

Sample Response

{
  "value": [
    {
      "numberOfQueries": 5,
      "aggregationFunction": "sum",
      "observationMetric": "cpu",
      "intervalType": "P1D",
      "startTime": "03/10/2020 00:00:00",
      "endTime": "03/12/2020 13:00:00",
      "queries": [
        {
          "databaseName": "db1",
          "queryId": "28",
          "intervals": [
            {
              "intervalStartTime": "03/11/2020 00:00:00",
              "executionCount": 1,
              "metrics": [
                {
                  "name": "cpu",
                  "displayName": "Cpu",
                  "unit": "percentage",
                  "value": 0.0015934667245370371
                },
                {
                  "name": "io",
                  "displayName": "Physical Io Reads",
                  "unit": "percentage",
                  "value": 4.224537037037037E-06
                },
                {
                  "name": "logIo",
                  "displayName": "Log Writes",
                  "unit": "percentage",
                  "value": 0
                },
                {
                  "name": "memory",
                  "displayName": "Memory consumption",
                  "unit": "KB",
                  "value": 8336
                },
                {
                  "name": "duration",
                  "displayName": "Query duration",
                  "unit": "microseconds",
                  "value": 11091296
                }
              ]
            }
          ]
        },
        {
          "databaseName": "db1",
          "queryId": "24",
          "intervals": [
            {
              "intervalStartTime": "03/11/2020 00:00:00",
              "executionCount": 1,
              "metrics": [
                {
                  "name": "cpu",
                  "displayName": "Cpu",
                  "unit": "percentage",
                  "value": 0.0009522783564814815
                },
                {
                  "name": "io",
                  "displayName": "Physical Io Reads",
                  "unit": "percentage",
                  "value": 1.7361111111111112E-07
                },
                {
                  "name": "logIo",
                  "displayName": "Log Writes",
                  "unit": "percentage",
                  "value": 0
                },
                {
                  "name": "memory",
                  "displayName": "Memory consumption",
                  "unit": "KB",
                  "value": 1024
                },
                {
                  "name": "duration",
                  "displayName": "Query duration",
                  "unit": "microseconds",
                  "value": 6625562
                }
              ]
            }
          ]
        },
        {
          "databaseName": "db1",
          "queryId": "3",
          "intervals": [
            {
              "intervalStartTime": "03/11/2020 00:00:00",
              "executionCount": 82,
              "metrics": [
                {
                  "name": "cpu",
                  "displayName": "Cpu",
                  "unit": "percentage",
                  "value": 0.0007183139467592593
                },
                {
                  "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": 4970199
                }
              ]
            }
          ]
        },
        {
          "databaseName": "db1",
          "queryId": "29",
          "intervals": [
            {
              "intervalStartTime": "03/11/2020 00:00:00",
              "executionCount": 1,
              "metrics": [
                {
                  "name": "cpu",
                  "displayName": "Cpu",
                  "unit": "percentage",
                  "value": 0.0006494454571759259
                },
                {
                  "name": "io",
                  "displayName": "Physical Io Reads",
                  "unit": "percentage",
                  "value": 5.034722222222222E-06
                },
                {
                  "name": "logIo",
                  "displayName": "Log Writes",
                  "unit": "percentage",
                  "value": 0
                },
                {
                  "name": "memory",
                  "displayName": "Memory consumption",
                  "unit": "KB",
                  "value": 1024
                },
                {
                  "name": "duration",
                  "displayName": "Query duration",
                  "unit": "microseconds",
                  "value": 4530668
                }
              ]
            }
          ]
        },
        {
          "databaseName": "db2",
          "queryId": "25",
          "intervals": [
            {
              "intervalStartTime": "03/11/2020 00:00:00",
              "executionCount": 1,
              "metrics": [
                {
                  "name": "cpu",
                  "displayName": "Cpu",
                  "unit": "percentage",
                  "value": 0.0006275368923611112
                },
                {
                  "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": 1024
                },
                {
                  "name": "duration",
                  "displayName": "Query duration",
                  "unit": "microseconds",
                  "value": 4349943
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

Obtain list of instance's top resource consuming queries. Minimal request and response.

Sample Request

GET https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/topqueries?api-version=2020-08-01-preview

Sample Response

{
  "value": [
    {
      "numberOfQueries": 5,
      "aggregationFunction": "sum",
      "observationMetric": "cpu",
      "intervalType": "PT1H",
      "startTime": "03/10/2020 12:00:00",
      "endTime": "03/11/2020 12:24:07",
      "queries": []
    }
  ]
}

定义

AggregationFunctionType

要使用的聚合函数,默认值为“sum”

MetricType

用于排名排名靠前查询的指标。 默认值为“cpu”

QueryMetricInterval

查询指标间隔的属性。

QueryMetricProperties

一个间隔内 topquery 指标的属性。

QueryMetricUnitType

指标的单位。

QueryStatisticsProperties

查询执行统计信息的属性。

QueryTimeGrainType

间隔类型 (长度) 。

TopQueries
TopQueriesListResult

托管实例上消耗排名靠前的资源查询列表

AggregationFunctionType

要使用的聚合函数,默认值为“sum”

Name Type Description
avg
  • string
max
  • string
min
  • string
stdev
  • string
sum
  • string

MetricType

用于排名排名靠前查询的指标。 默认值为“cpu”

Name Type Description
cpu
  • string
dtu
  • string
duration
  • string
io
  • string
logIo
  • string

QueryMetricInterval

查询指标间隔的属性。

Name Type Description
executionCount
  • integer

此间隔内查询的执行计数。

intervalStartTime
  • string

指标间隔的开始时间 (ISO-8601 格式) 。

intervalType

间隔类型 (长度) 。

metrics

此间隔的指标对象列表

QueryMetricProperties

一个间隔内 topquery 指标的属性。

Name Type Description
avg
  • number

在间隔内使用 avg () 聚合函数时的指标值。

displayName
  • string

指标的 UI 适当名称。

max
  • number

在间隔内使用 max () 聚合函数时的指标值。

min
  • number

在间隔内使用 min () 聚合函数时的指标值。

name
  • string

指标的名称信息。

stdev
  • number

在间隔内使用 stdev 聚合函数时的指标值。

sum
  • number

在间隔内使用 sum () 聚合函数时的指标值。

unit

指标的单位。

value
  • number

指标的值。

QueryMetricUnitType

指标的单位。

Name Type Description
KB
  • string
count
  • string
microseconds
  • string
percentage
  • string

QueryStatisticsProperties

查询执行统计信息的属性。

Name Type Description
databaseName
  • string

执行此查询的数据库的数据库名称。

endTime
  • string

指标的结束时间 (ISO-8601 格式) 。

intervals

包含适当指标数据的间隔列表

queryId
  • string

唯一查询 ID (一个数据库) 中唯一。

startTime
  • string

指标的开始时间 (ISO-8601 格式) 。

QueryTimeGrainType

间隔类型 (长度) 。

Name Type Description
P1D
  • string
PT1H
  • string

TopQueries

Name Type Description
aggregationFunction
  • string

用于计算查询指标的聚合函数。

endTime
  • string

指标的结束时间 (ISO-8601 格式) 。

intervalType

间隔类型 (长度) 。

numberOfQueries
  • integer

请求的排名靠前的查询数。

observationMetric
  • string

用于对查询进行排名的指标。

queries

具有适当指标数据的主要资源消耗查询列表

startTime
  • string

指标的开始时间 (ISO-8601 格式) 。

TopQueriesListResult

托管实例上消耗排名靠前的资源查询列表

Name Type Description
nextLink
  • string

用于检索下一页结果的链接。

value

结果数组。