{ "swagger": "2.0", "info": { "title": "Azure SQL Database", "description": "Provides create, read, update and delete functionality for Azure SQL Database resources including servers, databases, elastic pools, recommendations, operations, and usage metrics.", "version": "2014-04-01" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/topQueries": { "get": { "tags": [ "Queries" ], "operationId": "Queries_ListByDatabase", "description": "Gets a list of top queries by database.", "x-ms-examples": { "List top queries": { "$ref": "./examples/QueriesList.json" } }, "parameters": [ { "$ref": "../../../common/v1/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../common/v1/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../common/v1/types.json#/parameters/ResourceGroupParameter" }, { "$ref": "#/parameters/ServerNameParameter" }, { "$ref": "#/parameters/DatabaseNameParameter" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/TopQueriesListResult" } } }, "x-ms-pageable": { "nextLinkName": null } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/topQueries/{queryId}/statistics": { "get": { "tags": [ "Queries" ], "operationId": "QueryStatistics_ListByQuery", "description": "Lists a query's statistics.", "x-ms-examples": { "Get a query": { "$ref": "./examples/QueryStatisticsList.json" } }, "parameters": [ { "$ref": "../../../common/v1/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../common/v1/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../common/v1/types.json#/parameters/ResourceGroupParameter" }, { "$ref": "#/parameters/ServerNameParameter" }, { "$ref": "#/parameters/DatabaseNameParameter" }, { "name": "queryId", "type": "string", "description": "The id of the query", "required": true, "in": "path" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/QueryStatisticListResult" } } }, "x-ms-pageable": { "nextLinkName": null } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/topQueries/{queryId}/queryText": { "get": { "tags": [ "Queries" ], "operationId": "QueryTexts_ListByQuery", "description": "Gets a query's text.", "x-ms-examples": { "Get a query": { "$ref": "./examples/QueryTextsList.json" } }, "parameters": [ { "$ref": "../../../common/v1/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../common/v1/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../common/v1/types.json#/parameters/ResourceGroupParameter" }, { "$ref": "#/parameters/ServerNameParameter" }, { "$ref": "#/parameters/DatabaseNameParameter" }, { "name": "queryId", "type": "string", "description": "The id of the query", "required": true, "in": "path" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/QueryTextListResult" } } }, "x-ms-pageable": { "nextLinkName": null } } } }, "definitions": { "TopQueries": { "properties": { "aggregationFunction": { "description": "The function that is used to aggregate each query's metrics.", "type": "string", "enum": [ "min", "max", "avg", "sum" ], "x-ms-enum": { "name": "QueryAggregationFunction", "modelAsString": false }, "readOnly": true }, "executionType": { "description": "The execution type that is used to filter the query instances that are returned.", "type": "string", "enum": [ "any", "regular", "irregular", "aborted", "exception" ], "x-ms-enum": { "name": "QueryExecutionType", "modelAsString": false }, "readOnly": true }, "intervalType": { "description": "The duration of the interval (ISO8601 duration format).", "type": "string", "readOnly": true }, "numberOfTopQueries": { "description": "The number of requested queries.", "type": "number", "format": "int32", "readOnly": true }, "observationStartTime": { "description": "The start time for queries that are returned (ISO8601 format)", "type": "string", "format": "date-time", "readOnly": true }, "observationEndTime": { "description": "The end time for queries that are returned (ISO8601 format)", "type": "string", "format": "date-time", "readOnly": true }, "observedMetric": { "description": "The type of metric to use for ordering the top metrics.", "type": "string", "enum": [ "cpu", "io", "logio", "duration", "executionCount" ], "x-ms-enum": { "name": "QueryObservedMetricType", "modelAsString": false }, "readOnly": true }, "queries": { "type": "array", "items": { "$ref": "#/definitions/QueryStatistic" }, "description": "The list of queries.", "readOnly": true } }, "description": "A database query." }, "QueryStatistic": { "properties": { "queryId": { "description": "The id of the query", "type": "string", "readOnly": true }, "intervals": { "type": "array", "items": { "$ref": "#/definitions/QueryInterval" }, "description": "The list of query intervals.", "readOnly": true } }, "description": "A database query." }, "QueryInterval": { "properties": { "intervalStartTime": { "description": "The start time of the measurement interval (ISO8601 format).", "type": "string", "format": "date-time", "readOnly": true }, "executionCount": { "description": "The number of times the query was executed during this interval.", "type": "number", "format": "int32", "readOnly": true }, "metrics": { "type": "array", "items": { "$ref": "#/definitions/QueryMetric" }, "description": "The list of query metrics during this interval.", "readOnly": true } }, "description": "A database query." }, "QueryMetric": { "properties": { "name": { "description": "The name of the metric", "type": "string", "readOnly": true }, "displayName": { "description": "The name of the metric for display in user interface", "type": "string", "readOnly": true }, "unit": { "description": "The unit of measurement", "type": "string", "enum": [ "percentage", "KB", "microseconds" ], "x-ms-enum": { "name": "QueryMetricUnit", "modelAsString": false }, "readOnly": true }, "value": { "description": "The measured value", "type": "number", "format": "double", "readOnly": true } }, "description": "A database query." }, "TopQueriesListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/TopQueries" }, "description": "The list of top queries." } }, "required": [ "value" ], "description": "Represents the response to a get top queries request." }, "QueryStatisticListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/QueryStatistic" }, "description": "The query." } }, "required": [ "value" ], "description": "Represents the response to a get query request." }, "QueryText": { "properties": { "name": { "readOnly": true, "type": "string", "description": "Resource name." }, "type": { "readOnly": true, "type": "string", "description": "Resource type." }, "queryText": { "readOnly": true, "type": "string", "description": "Query text." } } }, "QueryTextListResult": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/QueryText" }, "description": "The query text." } }, "required": [ "value" ], "description": "Represents the response to a get query text request." } }, "parameters": { "ServerNameParameter": { "name": "serverName", "in": "path", "required": true, "type": "string", "description": "The name of the server.", "x-ms-parameter-location": "method" }, "DatabaseNameParameter": { "name": "databaseName", "in": "path", "description": "The name of the database.", "required": true, "type": "string", "x-ms-parameter-location": "method" } }, "securityDefinitions": { "azure_auth": { "type": "oauth2", "description": "Azure Active Directory OAuth2 Flow", "flow": "implicit", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "scopes": { "user_impersonation": "impersonate your user account" } } } }