Skip to content

Creating a general recommendation controller #34479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,17 @@
"TuningIndex_ListRecommendations": {
"$ref": "./examples/TuningIndex_GetRecommendations.json"
},
"TuningIndex_ListTableRecommendations": {
"$ref": "./examples/TuningIndex_GetTableRecommendations.json"
},
"TuningIndex_ListFilteredRecommendations": {
"$ref": "./examples/TuningIndex_GetFilteredRecommendations.json"
},
"TuningIndex_ListFilteredTableRecommendations": {
"$ref": "./examples/TuningIndex_GetFilteredTableRecommendations.json"
}
},
"description": "Retrieve the list of available tuning index recommendations.",
"description": "Retrieve the list of available tuning recommendations.",
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v6/types.json#/parameters/ApiVersionParameter"
Expand All @@ -118,7 +124,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/IndexRecommendationListResult"
"$ref": "#/definitions/ObjectRecommendationListResult"
}
},
"default": {
Expand Down Expand Up @@ -516,7 +522,7 @@
},
"description": "Stores property that features impact on some metric if this recommended action is applied."
},
"IndexRecommendationDetails": {
"ObjectRecommendationDetails": {
"type": "object",
"properties": {
"databaseName": {
Expand Down Expand Up @@ -557,7 +563,7 @@
"description": "Recommendation details for the recommended action.",
"readOnly": true
},
"IndexRecommendationResourceProperties": {
"ObjectRecommendationResourceProperties": {
"type": "object",
"properties": {
"initialRecommendedTime": {
Expand Down Expand Up @@ -592,7 +598,8 @@
"enum": [
"CreateIndex",
"DropIndex",
"ReIndex"
"ReIndex",
"AnalyzeTable"
],
"x-ms-enum": {
"name": "RecommendationTypeEnum",
Expand Down Expand Up @@ -647,39 +654,39 @@
"description": "The estimated impact of this recommended action"
},
"details": {
"$ref": "#/definitions/IndexRecommendationDetails",
"$ref": "#/definitions/ObjectRecommendationDetails",
"description": "Stores recommendation details for the recommended action."
}
},
"description": "Index recommendation properties.",
"description": "Object recommendation properties.",
"readOnly": true
},
"IndexRecommendationResource": {
"ObjectRecommendationResource": {
"type": "object",
"properties": {
"properties": {
"$ref": "#/definitions/IndexRecommendationResourceProperties",
"$ref": "#/definitions/ObjectRecommendationResourceProperties",
"x-ms-client-flatten": true,
"description": "Properties of IndexRecommendationResource."
"description": "Properties of ObjectRecommendationResource."
}
},
"allOf": [
{
"$ref": "../../../../../common-types/resource-management/v6/types.json#/definitions/ProxyResource"
}
],
"description": "Index recommendation properties."
"description": "Object recommendation properties."
},
"IndexRecommendationListResult": {
"description": "A list of available index recommendations.",
"ObjectRecommendationListResult": {
"description": "A list of available recommendations.",
"type": "object",
"properties": {
"value": {
"description": "A list of available index recommendations.",
"description": "A list of available recommendations.",
"uniqueItems": false,
"type": "array",
"items": {
"$ref": "#/definitions/IndexRecommendationResource"
"$ref": "#/definitions/ObjectRecommendationResource"
},
"x-ms-identifiers": [
"name"
Expand Down Expand Up @@ -858,7 +865,8 @@
"type": "string",
"enum": [
"index",
"configuration"
"configuration",
"table"
],
"description": "The name of the tuning option.",
"x-ms-enum": {
Expand All @@ -874,7 +882,8 @@
"type": "string",
"enum": [
"CreateIndex",
"DropIndex"
"DropIndex",
"AnalyzeTable"
],
"description": "Recommendations list filter. Retrieves recommendations based on type.",
"x-ms-enum": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"parameters": {
"serverName": "arm3",
"resourceGroupName": "s0403mllorentpimmy",
"api-version": "2025-04-01-preview",
"subscriptionId": "929287ae-832a-4946-8006-a6cc2a3f7244",
"tuningOption": "table",
"recommendationType": "AnalyzeTable"
},
"responses": {
"200": {
"body": {
"value": [
{
"value": [
{
"kind": "",
"properties": {
"initialRecommendedTime": "2025-04-11T22:36:02.861509Z",
"lastRecommendedTime": "2025-04-11T22:36:02.861509Z",
"timesRecommended": 1,
"improvedQueryIds": [
2071439792137543700,
7860150533486302000,
6411979446509506000,
3219604056681277400,
-360410933364310600,
6171467644166225000,
3548728559597612500,
-4753875211349607000,
-8711548294430095000
],
"recommendationReason": "Table \"nation\" in schema \"public\" is unanalyzed and appears in the following queries: 2071439792137543669, 7860150533486301820, 6411979446509505239, 3219604056681277471, -360410933364310591, 6171467644166224729, 3548728559597612316, -4753875211349607298, -8711548294430094920",
"recommendationType": "Analyze",
"implementationDetails": {
"method": "SQL",
"script": "analyze table public.nation"
},
"analyzedWorkload": {
"startTime": "2025-04-11T06:35:51.6076203Z",
"endTime": "2025-04-11T18:35:51.6075453Z",
"queryCount": 22
},
"estimatedImpact": [],
"details": {
"databaseName": "postgres",
"schema": "public",
"table": "nation"
}
},
"id": "/subscriptions/929287ae-832a-4946-8006-a6cc2a3f7244/resourceGroups/s0403mllorentpimmy/providers/Microsoft.DBforPostgreSQL/flexibleServers/arm3/tuningOptions/table/recommendations/11",
"name": "Analyze_postgres_public_nation",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/table"
},
{
"kind": "",
"properties": {
"initialRecommendedTime": "2025-04-11T22:36:02.865255Z",
"lastRecommendedTime": "2025-04-11T22:36:02.865255Z",
"timesRecommended": 1,
"improvedQueryIds": [
3219604056681277400,
6171467644166225000,
-4753875211349607000
],
"recommendationReason": "Table \"region\" in schema \"public\" is unanalyzed and appears in the following queries: 3219604056681277471, 6171467644166224729, -4753875211349607298",
"recommendationType": "Analyze",
"implementationDetails": {
"method": "SQL",
"script": "analyze table public.region"
},
"analyzedWorkload": {
"startTime": "2025-04-11T06:35:51.6076203Z",
"endTime": "2025-04-11T18:35:51.6075453Z",
"queryCount": 22
},
"estimatedImpact": [],
"details": {
"databaseName": "postgres",
"schema": "public",
"table": "region"
}
},
"id": "/subscriptions/929287ae-832a-4946-8006-a6cc2a3f7244/resourceGroups/s0403mllorentpimmy/providers/Microsoft.DBforPostgreSQL/flexibleServers/arm3/tuningOptions/table/recommendations/12",
"name": "Analyze_postgres_public_region",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/table"
}
]
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"parameters": {
"serverName": "pgtestsvc4",
"resourceGroupName": "testrg",
"api-version": "2025-04-01-preview",
"subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff",
"tuningOption": "table"
},
"responses": {
"200": {
"body": {
"value": [
{
"kind": "",
"properties": {
"initialRecommendedTime": "2025-04-11T22:36:02.861509Z",
"lastRecommendedTime": "2025-04-11T22:36:02.861509Z",
"timesRecommended": 1,
"improvedQueryIds": [
2071439792137543700,
7860150533486302000,
6411979446509506000,
3219604056681277400,
-360410933364310600,
6171467644166225000,
3548728559597612500,
-4753875211349607000,
-8711548294430095000
],
"recommendationReason": "Table \"nation\" in schema \"public\" is unanalyzed and appears in the following queries: 2071439792137543669, 7860150533486301820, 6411979446509505239, 3219604056681277471, -360410933364310591, 6171467644166224729, 3548728559597612316, -4753875211349607298, -8711548294430094920",
"recommendationType": "Analyze",
"implementationDetails": {
"method": "SQL",
"script": "analyze table public.nation"
},
"analyzedWorkload": {
"startTime": "2025-04-11T06:35:51.6076203Z",
"endTime": "2025-04-11T18:35:51.6075453Z",
"queryCount": 22
},
"estimatedImpact": [],
"details": {
"databaseName": "postgres",
"schema": "public",
"table": "nation"
}
},
"id": "/subscriptions/929287ae-832a-4946-8006-a6cc2a3f7244/resourceGroups/s0403mllorentpimmy/providers/Microsoft.DBforPostgreSQL/flexibleServers/arm3/tuningOptions/table/recommendations/11",
"name": "Analyze_postgres_public_nation",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/table"
},
{
"kind": "",
"properties": {
"initialRecommendedTime": "2025-04-11T22:36:02.865255Z",
"lastRecommendedTime": "2025-04-11T22:36:02.865255Z",
"timesRecommended": 1,
"improvedQueryIds": [
3219604056681277400,
6171467644166225000,
-4753875211349607000
],
"recommendationReason": "Table \"region\" in schema \"public\" is unanalyzed and appears in the following queries: 3219604056681277471, 6171467644166224729, -4753875211349607298",
"recommendationType": "Analyze",
"implementationDetails": {
"method": "SQL",
"script": "analyze table public.region"
},
"analyzedWorkload": {
"startTime": "2025-04-11T06:35:51.6076203Z",
"endTime": "2025-04-11T18:35:51.6075453Z",
"queryCount": 22
},
"estimatedImpact": [],
"details": {
"databaseName": "postgres",
"schema": "public",
"table": "region"
}
},
"id": "/subscriptions/929287ae-832a-4946-8006-a6cc2a3f7244/resourceGroups/s0403mllorentpimmy/providers/Microsoft.DBforPostgreSQL/flexibleServers/arm3/tuningOptions/table/recommendations/12",
"name": "Analyze_postgres_public_region",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/table"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
{
"parameters": {
"serverName": "testserver",
"resourceGroupName": "testrg",
"api-version": "2025-01-01-preview",
"subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff"
"serverName": "arm3",
"resourceGroupName": "s0403mllorentpimmy",
"api-version": "2025-04-01-preview",
"subscriptionId": "929287ae-832a-4946-8006-a6cc2a3f7244"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/testserver/tuningoptions/index",
"properties": {},
"id": "/subscriptions/929287ae-832a-4946-8006-a6cc2a3f7244/resourceGroups/s0403mllorentpimmy/providers/Microsoft.DBforPostgreSQL/flexibleServers/arm3/tuningOptions/index",
"name": "index",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningoptions"
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions"
},
{
"properties": {
"state": "Disabled"
},
"id": "/subscriptions/929287ae-832a-4946-8006-a6cc2a3f7244/resourceGroups/s0403mllorentpimmy/providers/Microsoft.DBforPostgreSQL/flexibleServers/arm3/tuningOptions/configuration",
"name": "configuration",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions"
},
{
"properties": {},
"id": "/subscriptions/929287ae-832a-4946-8006-a6cc2a3f7244/resourceGroups/s0403mllorentpimmy/providers/Microsoft.DBforPostgreSQL/flexibleServers/arm3/tuningOptions/table",
"name": "table",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions"
}
]
}
Expand Down
Loading