Listet verfügbare Objektempfehlungen auf.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/recommendations?api-version=2025-08-01
Mit optionalen Parametern:
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/recommendations?api-version=2025-08-01&recommendationType={recommendationType}
URI-Parameter
| Name |
In |
Erforderlich |
Typ |
Beschreibung |
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Der Name der Ressourcengruppe. Bei dem Namen wird die Groß-/Kleinschreibung nicht beachtet.
|
|
serverName
|
path |
True
|
string
minLength: 3 maxLength: 63 pattern: ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*
|
Name des Servers
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
Die ID des Zielabonnements. Der Wert muss eine UUID sein.
|
|
tuningOption
|
path |
True
|
TuningOptionParameterEnum
|
Der Name der Optimierungsoption.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Hierbei handelt es sich um die für diesen Vorgang zu verwendende API-Version.
|
|
recommendationType
|
query |
|
RecommendationTypeParameterEnum
|
Filter für die Empfehlungsliste. Ruft Empfehlungen basierend auf dem Typ ab.
|
Antworten
Sicherheit
azure_auth
Azure Active Directory OAuth2 Flow.
Typ:
oauth2
Ablauf:
implicit
Autorisierungs-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiche
| Name |
Beschreibung |
|
user_impersonation
|
Identitätswechsel ihres Benutzerkontos
|
Beispiele
List available index recommendations, filtered to exclusively get those of CREATE INDEX type.
Beispielanforderung
GET https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/index/recommendations?api-version=2025-08-01&recommendationType=CreateIndex
import com.azure.resourcemanager.postgresqlflexibleserver.models.RecommendationTypeParameterEnum;
import com.azure.resourcemanager.postgresqlflexibleserver.models.TuningOptionParameterEnum;
/**
* Samples for TuningOptionsOperation ListRecommendations.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json
*/
/**
* Sample code: List available index recommendations, filtered to exclusively get those of CREATE INDEX type.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCREATEINDEXType(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.tuningOptionsOperations().listRecommendations("exampleresourcegroup", "exampleserver",
TuningOptionParameterEnum.INDEX, RecommendationTypeParameterEnum.CREATE_INDEX,
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python tuning_options_list_index_recommendations_filtered_for_create_index.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.tuning_options.list_recommendations(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
tuning_option="index",
)
for item in response:
print(item)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json
func ExampleTuningOptionsClient_NewListRecommendationsPager_listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewTuningOptionsClient().NewListRecommendationsPager("exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.TuningOptionParameterEnumIndex, &armpostgresqlflexibleservers.TuningOptionsClientListRecommendationsOptions{RecommendationType: to.Ptr(armpostgresqlflexibleservers.RecommendationTypeParameterEnumCreateIndex)})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.ObjectRecommendationList = armpostgresqlflexibleservers.ObjectRecommendationList{
// Value: []*armpostgresqlflexibleservers.ObjectRecommendation{
// {
// Name: to.Ptr("CreateIndex_ecommerce_public_ps_suppkey_idx"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/index"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/index/recommendations/1"),
// Kind: to.Ptr(""),
// Properties: &armpostgresqlflexibleservers.ObjectRecommendationProperties{
// AnalyzedWorkload: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesAnalyzedWorkload{
// EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// QueryCount: to.Ptr[int32](25),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T19:30:22.123Z"); return t}()),
// },
// EstimatedImpact: []*armpostgresqlflexibleservers.ImpactRecord{
// {
// AbsoluteValue: to.Ptr[float64](15.3671875),
// DimensionName: to.Ptr("IndexSize"),
// Unit: to.Ptr("MB"),
// },
// {
// AbsoluteValue: to.Ptr[float64](99.67668452400453),
// DimensionName: to.Ptr("QueryCostImprovement"),
// QueryID: to.Ptr[int64](-3775242682326862300),
// Unit: to.Ptr("Percentage"),
// },
// {
// AbsoluteValue: to.Ptr[float64](85.56742436827899),
// DimensionName: to.Ptr("QueryCostImprovement"),
// QueryID: to.Ptr[int64](6829938984138799000),
// Unit: to.Ptr("Percentage"),
// }},
// ImplementationDetails: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesImplementationDetails{
// Method: to.Ptr("SQL"),
// Script: to.Ptr("create index concurrently ps_suppkey_idx on public.partsupp(ps_suppkey)"),
// },
// ImprovedQueryIDs: []*int64{
// to.Ptr[int64](-3775242682326862300),
// to.Ptr[int64](6829938984138799000)},
// InitialRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// LastRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// RecommendationReason: to.Ptr("Column \"partsupp\".\"ps_suppkey\" appear in Join On clause(s) in query -3775242682326862475; Column \"partsupp\".\"ps_suppkey\" appear in Join On clause(s) in query 6829938984138799352;"),
// RecommendationType: to.Ptr(armpostgresqlflexibleservers.RecommendationTypeEnumCreateIndex),
// TimesRecommended: to.Ptr[int32](1),
// Details: &armpostgresqlflexibleservers.ObjectRecommendationDetails{
// Schema: to.Ptr("public"),
// DatabaseName: to.Ptr("ecommerce"),
// IndexColumns: []*string{
// to.Ptr("\"partsupp\".\"ps_suppkey\"")},
// IndexName: to.Ptr("ps_suppkey_idx"),
// IndexType: to.Ptr("BTREE"),
// Table: to.Ptr("partsupp"),
// },
// },
// },
// {
// Name: to.Ptr("CreateIndex_ecommerce_public_ps_partkey_idx"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/index"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/index/recommendations/2"),
// Kind: to.Ptr(""),
// Properties: &armpostgresqlflexibleservers.ObjectRecommendationProperties{
// AnalyzedWorkload: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesAnalyzedWorkload{
// EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// QueryCount: to.Ptr[int32](25),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T19:30:22.123Z"); return t}()),
// },
// EstimatedImpact: []*armpostgresqlflexibleservers.ImpactRecord{
// {
// AbsoluteValue: to.Ptr[float64](15.3671875),
// DimensionName: to.Ptr("IndexSize"),
// Unit: to.Ptr("MB"),
// },
// {
// AbsoluteValue: to.Ptr[float64](99.67668452400453),
// DimensionName: to.Ptr("QueryCostImprovement"),
// QueryID: to.Ptr[int64](-3775242682326862300),
// Unit: to.Ptr("Percentage"),
// },
// {
// AbsoluteValue: to.Ptr[float64](79.06603712430707),
// DimensionName: to.Ptr("QueryCostImprovement"),
// QueryID: to.Ptr[int64](4735984994430715000),
// Unit: to.Ptr("Percentage"),
// }},
// ImplementationDetails: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesImplementationDetails{
// Method: to.Ptr("SQL"),
// Script: to.Ptr("create index concurrently ps_partkey_idx on public.partsupp(ps_partkey)"),
// },
// ImprovedQueryIDs: []*int64{
// to.Ptr[int64](-3775242682326862300),
// to.Ptr[int64](4735984994430715000)},
// InitialRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// LastRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// RecommendationReason: to.Ptr("Column \"partsupp\".\"ps_partkey\" appear in Equal Predicate clause(s) in query -3775242682326862475; Column \"partsupp\".\"ps_partkey\" appear in Join On clause(s) in query 4735984994430714735;"),
// RecommendationType: to.Ptr(armpostgresqlflexibleservers.RecommendationTypeEnumCreateIndex),
// TimesRecommended: to.Ptr[int32](1),
// Details: &armpostgresqlflexibleservers.ObjectRecommendationDetails{
// Schema: to.Ptr("public"),
// DatabaseName: to.Ptr("ecommerce"),
// IndexColumns: []*string{
// to.Ptr("\"partsupp\".\"ps_partkey\"")},
// IndexName: to.Ptr("ps_partkey_idx"),
// IndexType: to.Ptr("BTREE"),
// Table: to.Ptr("partsupp"),
// },
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Lists available object recommendations.
*
* @summary Lists available object recommendations.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json
*/
async function listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const tuningOption = "index";
const recommendationType = "CreateIndex";
const options = {
recommendationType,
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const resArray = new Array();
for await (const item of client.tuningOptionsOperations.listRecommendations(
resourceGroupName,
serverName,
tuningOption,
options,
)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json
// this example is just showing the usage of "TuningOptions_ListRecommendations" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this PostgreSqlFlexibleServerTuningOptionResource created on azure
// for more information of creating PostgreSqlFlexibleServerTuningOptionResource, please refer to the document of PostgreSqlFlexibleServerTuningOptionResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
string serverName = "exampleserver";
PostgreSqlFlexibleServerTuningOptionType tuningOption = PostgreSqlFlexibleServerTuningOptionType.Index;
ResourceIdentifier postgreSqlFlexibleServerTuningOptionResourceId = PostgreSqlFlexibleServerTuningOptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, tuningOption);
PostgreSqlFlexibleServerTuningOptionResource postgreSqlFlexibleServerTuningOption = client.GetPostgreSqlFlexibleServerTuningOptionResource(postgreSqlFlexibleServerTuningOptionResourceId);
// invoke the operation and iterate over the result
PostgreSqlFlexibleServerRecommendationFilterType? recommendationType = PostgreSqlFlexibleServerRecommendationFilterType.CreateIndex;
await foreach (ObjectRecommendation item in postgreSqlFlexibleServerTuningOption.GetRecommendationsAsync(recommendationType: recommendationType))
{
Console.WriteLine($"Succeeded: {item}");
}
Console.WriteLine("Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
{
"value": [
{
"name": "CreateIndex_ecommerce_public_ps_suppkey_idx",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/index",
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/index/recommendations/1",
"kind": "",
"properties": {
"analyzedWorkload": {
"endTime": "2025-06-01T20:30:22.123456Z",
"queryCount": 25,
"startTime": "2025-06-01T19:30:22.123456Z"
},
"estimatedImpact": [
{
"absoluteValue": 15.3671875,
"dimensionName": "IndexSize",
"unit": "MB"
},
{
"absoluteValue": 99.67668452400453,
"dimensionName": "QueryCostImprovement",
"queryId": -3775242682326862300,
"unit": "Percentage"
},
{
"absoluteValue": 85.56742436827899,
"dimensionName": "QueryCostImprovement",
"queryId": 6829938984138799000,
"unit": "Percentage"
}
],
"implementationDetails": {
"method": "SQL",
"script": "create index concurrently ps_suppkey_idx on public.partsupp(ps_suppkey)"
},
"improvedQueryIds": [
-3775242682326862300,
6829938984138799000
],
"initialRecommendedTime": "2025-06-01T20:30:22.123456Z",
"lastRecommendedTime": "2025-06-01T20:30:22.123456Z",
"recommendationReason": "Column \"partsupp\".\"ps_suppkey\" appear in Join On clause(s) in query -3775242682326862475; Column \"partsupp\".\"ps_suppkey\" appear in Join On clause(s) in query 6829938984138799352;",
"recommendationType": "CreateIndex",
"timesRecommended": 1,
"details": {
"schema": "public",
"databaseName": "ecommerce",
"indexColumns": [
"\"partsupp\".\"ps_suppkey\""
],
"indexName": "ps_suppkey_idx",
"indexType": "BTREE",
"table": "partsupp"
}
}
},
{
"name": "CreateIndex_ecommerce_public_ps_partkey_idx",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/index",
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/index/recommendations/2",
"kind": "",
"properties": {
"analyzedWorkload": {
"endTime": "2025-06-01T20:30:22.123456Z",
"queryCount": 25,
"startTime": "2025-06-01T19:30:22.123456Z"
},
"estimatedImpact": [
{
"absoluteValue": 15.3671875,
"dimensionName": "IndexSize",
"unit": "MB"
},
{
"absoluteValue": 99.67668452400453,
"dimensionName": "QueryCostImprovement",
"queryId": -3775242682326862300,
"unit": "Percentage"
},
{
"absoluteValue": 79.06603712430707,
"dimensionName": "QueryCostImprovement",
"queryId": 4735984994430715000,
"unit": "Percentage"
}
],
"implementationDetails": {
"method": "SQL",
"script": "create index concurrently ps_partkey_idx on public.partsupp(ps_partkey)"
},
"improvedQueryIds": [
-3775242682326862300,
4735984994430715000
],
"initialRecommendedTime": "2025-06-01T20:30:22.123456Z",
"lastRecommendedTime": "2025-06-01T20:30:22.123456Z",
"recommendationReason": "Column \"partsupp\".\"ps_partkey\" appear in Equal Predicate clause(s) in query -3775242682326862475; Column \"partsupp\".\"ps_partkey\" appear in Join On clause(s) in query 4735984994430714735;",
"recommendationType": "CreateIndex",
"timesRecommended": 1,
"details": {
"schema": "public",
"databaseName": "ecommerce",
"indexColumns": [
"\"partsupp\".\"ps_partkey\""
],
"indexName": "ps_partkey_idx",
"indexType": "BTREE",
"table": "partsupp"
}
}
}
]
}
List available index recommendations.
Beispielanforderung
GET https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/index/recommendations?api-version=2025-08-01
import com.azure.resourcemanager.postgresqlflexibleserver.models.TuningOptionParameterEnum;
/**
* Samples for TuningOptionsOperation ListRecommendations.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* TuningOptionsListIndexRecommendations.json
*/
/**
* Sample code: List available index recommendations.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void listAvailableIndexRecommendations(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.tuningOptionsOperations().listRecommendations("exampleresourcegroup", "exampleserver",
TuningOptionParameterEnum.INDEX, null, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python tuning_options_list_index_recommendations.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.tuning_options.list_recommendations(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
tuning_option="index",
)
for item in response:
print(item)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendations.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendations.json
func ExampleTuningOptionsClient_NewListRecommendationsPager_listAvailableIndexRecommendations() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewTuningOptionsClient().NewListRecommendationsPager("exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.TuningOptionParameterEnumIndex, &armpostgresqlflexibleservers.TuningOptionsClientListRecommendationsOptions{RecommendationType: nil})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.ObjectRecommendationList = armpostgresqlflexibleservers.ObjectRecommendationList{
// Value: []*armpostgresqlflexibleservers.ObjectRecommendation{
// {
// Name: to.Ptr("CreateIndex_ecommerce_public_ps_suppkey_idx"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/index"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/index/recommendations/1"),
// Kind: to.Ptr(""),
// Properties: &armpostgresqlflexibleservers.ObjectRecommendationProperties{
// AnalyzedWorkload: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesAnalyzedWorkload{
// EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// QueryCount: to.Ptr[int32](25),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T19:30:22.123Z"); return t}()),
// },
// EstimatedImpact: []*armpostgresqlflexibleservers.ImpactRecord{
// {
// AbsoluteValue: to.Ptr[float64](15.3671875),
// DimensionName: to.Ptr("IndexSize"),
// Unit: to.Ptr("MB"),
// },
// {
// AbsoluteValue: to.Ptr[float64](99.67668452400453),
// DimensionName: to.Ptr("QueryCostImprovement"),
// QueryID: to.Ptr[int64](-3775242682326862300),
// Unit: to.Ptr("Percentage"),
// },
// {
// AbsoluteValue: to.Ptr[float64](85.56742436827899),
// DimensionName: to.Ptr("QueryCostImprovement"),
// QueryID: to.Ptr[int64](6829938984138799000),
// Unit: to.Ptr("Percentage"),
// }},
// ImplementationDetails: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesImplementationDetails{
// Method: to.Ptr("SQL"),
// Script: to.Ptr("create index concurrently ps_suppkey_idx on public.partsupp(ps_suppkey)"),
// },
// ImprovedQueryIDs: []*int64{
// to.Ptr[int64](-3775242682326862300),
// to.Ptr[int64](6829938984138799000)},
// InitialRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// LastRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// RecommendationReason: to.Ptr("Column \"partsupp\".\"ps_suppkey\" appear in Join On clause(s) in query -3775242682326862475; Column \"partsupp\".\"ps_suppkey\" appear in Join On clause(s) in query 6829938984138799352;"),
// RecommendationType: to.Ptr(armpostgresqlflexibleservers.RecommendationTypeEnumCreateIndex),
// TimesRecommended: to.Ptr[int32](1),
// Details: &armpostgresqlflexibleservers.ObjectRecommendationDetails{
// Schema: to.Ptr("public"),
// DatabaseName: to.Ptr("ecommerce"),
// IndexColumns: []*string{
// to.Ptr("\"partsupp\".\"ps_suppkey\"")},
// IndexName: to.Ptr("ps_suppkey_idx"),
// IndexType: to.Ptr("BTREE"),
// Table: to.Ptr("partsupp"),
// },
// },
// },
// {
// Name: to.Ptr("CreateIndex_ecommerce_public_ps_partkey_idx"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/index"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/index/recommendations/2"),
// Kind: to.Ptr(""),
// Properties: &armpostgresqlflexibleservers.ObjectRecommendationProperties{
// AnalyzedWorkload: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesAnalyzedWorkload{
// EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// QueryCount: to.Ptr[int32](25),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T19:30:22.123Z"); return t}()),
// },
// EstimatedImpact: []*armpostgresqlflexibleservers.ImpactRecord{
// {
// AbsoluteValue: to.Ptr[float64](15.3671875),
// DimensionName: to.Ptr("IndexSize"),
// Unit: to.Ptr("MB"),
// },
// {
// AbsoluteValue: to.Ptr[float64](99.67668452400453),
// DimensionName: to.Ptr("QueryCostImprovement"),
// QueryID: to.Ptr[int64](-3775242682326862300),
// Unit: to.Ptr("Percentage"),
// },
// {
// AbsoluteValue: to.Ptr[float64](79.06603712430707),
// DimensionName: to.Ptr("QueryCostImprovement"),
// QueryID: to.Ptr[int64](4735984994430715000),
// Unit: to.Ptr("Percentage"),
// }},
// ImplementationDetails: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesImplementationDetails{
// Method: to.Ptr("SQL"),
// Script: to.Ptr("create index concurrently ps_partkey_idx on public.partsupp(ps_partkey)"),
// },
// ImprovedQueryIDs: []*int64{
// to.Ptr[int64](-3775242682326862300),
// to.Ptr[int64](4735984994430715000)},
// InitialRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// LastRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// RecommendationReason: to.Ptr("Column \"partsupp\".\"ps_partkey\" appear in Equal Predicate clause(s) in query -3775242682326862475; Column \"partsupp\".\"ps_partkey\" appear in Join On clause(s) in query 4735984994430714735;"),
// RecommendationType: to.Ptr(armpostgresqlflexibleservers.RecommendationTypeEnumCreateIndex),
// TimesRecommended: to.Ptr[int32](1),
// Details: &armpostgresqlflexibleservers.ObjectRecommendationDetails{
// Schema: to.Ptr("public"),
// DatabaseName: to.Ptr("ecommerce"),
// IndexColumns: []*string{
// to.Ptr("\"partsupp\".\"ps_partkey\"")},
// IndexName: to.Ptr("ps_partkey_idx"),
// IndexType: to.Ptr("BTREE"),
// Table: to.Ptr("partsupp"),
// },
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Lists available object recommendations.
*
* @summary Lists available object recommendations.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendations.json
*/
async function listAvailableIndexRecommendations() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const tuningOption = "index";
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const resArray = new Array();
for await (const item of client.tuningOptionsOperations.listRecommendations(
resourceGroupName,
serverName,
tuningOption,
)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendations.json
// this example is just showing the usage of "TuningOptions_ListRecommendations" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this PostgreSqlFlexibleServerTuningOptionResource created on azure
// for more information of creating PostgreSqlFlexibleServerTuningOptionResource, please refer to the document of PostgreSqlFlexibleServerTuningOptionResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
string serverName = "exampleserver";
PostgreSqlFlexibleServerTuningOptionType tuningOption = PostgreSqlFlexibleServerTuningOptionType.Index;
ResourceIdentifier postgreSqlFlexibleServerTuningOptionResourceId = PostgreSqlFlexibleServerTuningOptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, tuningOption);
PostgreSqlFlexibleServerTuningOptionResource postgreSqlFlexibleServerTuningOption = client.GetPostgreSqlFlexibleServerTuningOptionResource(postgreSqlFlexibleServerTuningOptionResourceId);
// invoke the operation and iterate over the result
await foreach (ObjectRecommendation item in postgreSqlFlexibleServerTuningOption.GetRecommendationsAsync())
{
Console.WriteLine($"Succeeded: {item}");
}
Console.WriteLine("Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
{
"value": [
{
"name": "CreateIndex_ecommerce_public_ps_suppkey_idx",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/index",
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/index/recommendations/1",
"kind": "",
"properties": {
"analyzedWorkload": {
"endTime": "2025-06-01T20:30:22.123456Z",
"queryCount": 25,
"startTime": "2025-06-01T19:30:22.123456Z"
},
"estimatedImpact": [
{
"absoluteValue": 15.3671875,
"dimensionName": "IndexSize",
"unit": "MB"
},
{
"absoluteValue": 99.67668452400453,
"dimensionName": "QueryCostImprovement",
"queryId": -3775242682326862300,
"unit": "Percentage"
},
{
"absoluteValue": 85.56742436827899,
"dimensionName": "QueryCostImprovement",
"queryId": 6829938984138799000,
"unit": "Percentage"
}
],
"implementationDetails": {
"method": "SQL",
"script": "create index concurrently ps_suppkey_idx on public.partsupp(ps_suppkey)"
},
"improvedQueryIds": [
-3775242682326862300,
6829938984138799000
],
"initialRecommendedTime": "2025-06-01T20:30:22.123456Z",
"lastRecommendedTime": "2025-06-01T20:30:22.123456Z",
"recommendationReason": "Column \"partsupp\".\"ps_suppkey\" appear in Join On clause(s) in query -3775242682326862475; Column \"partsupp\".\"ps_suppkey\" appear in Join On clause(s) in query 6829938984138799352;",
"recommendationType": "CreateIndex",
"timesRecommended": 1,
"details": {
"schema": "public",
"databaseName": "ecommerce",
"indexColumns": [
"\"partsupp\".\"ps_suppkey\""
],
"indexName": "ps_suppkey_idx",
"indexType": "BTREE",
"table": "partsupp"
}
}
},
{
"name": "CreateIndex_ecommerce_public_ps_partkey_idx",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/index",
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/index/recommendations/2",
"kind": "",
"properties": {
"analyzedWorkload": {
"endTime": "2025-06-01T20:30:22.123456Z",
"queryCount": 25,
"startTime": "2025-06-01T19:30:22.123456Z"
},
"estimatedImpact": [
{
"absoluteValue": 15.3671875,
"dimensionName": "IndexSize",
"unit": "MB"
},
{
"absoluteValue": 99.67668452400453,
"dimensionName": "QueryCostImprovement",
"queryId": -3775242682326862300,
"unit": "Percentage"
},
{
"absoluteValue": 79.06603712430707,
"dimensionName": "QueryCostImprovement",
"queryId": 4735984994430715000,
"unit": "Percentage"
}
],
"implementationDetails": {
"method": "SQL",
"script": "create index concurrently ps_partkey_idx on public.partsupp(ps_partkey)"
},
"improvedQueryIds": [
-3775242682326862300,
4735984994430715000
],
"initialRecommendedTime": "2025-06-01T20:30:22.123456Z",
"lastRecommendedTime": "2025-06-01T20:30:22.123456Z",
"recommendationReason": "Column \"partsupp\".\"ps_partkey\" appear in Equal Predicate clause(s) in query -3775242682326862475; Column \"partsupp\".\"ps_partkey\" appear in Join On clause(s) in query 4735984994430714735;",
"recommendationType": "CreateIndex",
"timesRecommended": 1,
"details": {
"schema": "public",
"databaseName": "ecommerce",
"indexColumns": [
"\"partsupp\".\"ps_partkey\""
],
"indexName": "ps_partkey_idx",
"indexType": "BTREE",
"table": "partsupp"
}
}
}
]
}
List available table recommendations, filtered to exclusively get those of ANALYZE TABLE type.
Beispielanforderung
GET https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/table/recommendations?api-version=2025-08-01&recommendationType=AnalyzeTable
import com.azure.resourcemanager.postgresqlflexibleserver.models.RecommendationTypeParameterEnum;
import com.azure.resourcemanager.postgresqlflexibleserver.models.TuningOptionParameterEnum;
/**
* Samples for TuningOptionsOperation ListRecommendations.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* TuningOptionsListTableRecommendationsFilteredForAnalyzeTable.json
*/
/**
* Sample code: List available table recommendations, filtered to exclusively get those of ANALYZE TABLE type.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfANALYZETABLEType(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.tuningOptionsOperations().listRecommendations("exampleresourcegroup", "exampleserver",
TuningOptionParameterEnum.TABLE, RecommendationTypeParameterEnum.ANALYZE_TABLE,
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python tuning_options_list_table_recommendations_filtered_for_analyze_table.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.tuning_options.list_recommendations(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
tuning_option="table",
)
for item in response:
print(item)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendationsFilteredForAnalyzeTable.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendationsFilteredForAnalyzeTable.json
func ExampleTuningOptionsClient_NewListRecommendationsPager_listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewTuningOptionsClient().NewListRecommendationsPager("exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.TuningOptionParameterEnumTable, &armpostgresqlflexibleservers.TuningOptionsClientListRecommendationsOptions{RecommendationType: to.Ptr(armpostgresqlflexibleservers.RecommendationTypeParameterEnumAnalyzeTable)})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.ObjectRecommendationList = armpostgresqlflexibleservers.ObjectRecommendationList{
// Value: []*armpostgresqlflexibleservers.ObjectRecommendation{
// {
// Name: to.Ptr("Analyze_postgres_public_nation"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/table"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/table/recommendations/1"),
// Kind: to.Ptr(""),
// Properties: &armpostgresqlflexibleservers.ObjectRecommendationProperties{
// AnalyzedWorkload: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesAnalyzedWorkload{
// EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// QueryCount: to.Ptr[int32](22),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T19:30:22.123Z"); return t}()),
// },
// EstimatedImpact: []*armpostgresqlflexibleservers.ImpactRecord{
// },
// ImplementationDetails: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesImplementationDetails{
// Method: to.Ptr("SQL"),
// Script: to.Ptr("analyze table public.nation"),
// },
// ImprovedQueryIDs: []*int64{
// to.Ptr[int64](2071439792137543700),
// to.Ptr[int64](7860150533486302000),
// to.Ptr[int64](6411979446509506000),
// to.Ptr[int64](3219604056681277400),
// to.Ptr[int64](-360410933364310600),
// to.Ptr[int64](6171467644166225000),
// to.Ptr[int64](3548728559597612500),
// to.Ptr[int64](-4753875211349607000),
// to.Ptr[int64](-8711548294430095000)},
// InitialRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// LastRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// RecommendationReason: to.Ptr("Table \"nation\" in schema \"public\" is unanalyzed and appears in the following queries: 2071439792137543669, 7860150533486301820, 6411979446509505239, 3219604056681277471, -360410933364310591, 6171467644166224729, 3548728559597612316, -4753875211349607298, -8711548294430094920"),
// RecommendationType: to.Ptr(armpostgresqlflexibleservers.RecommendationTypeEnum("Analyze")),
// TimesRecommended: to.Ptr[int32](1),
// Details: &armpostgresqlflexibleservers.ObjectRecommendationDetails{
// Schema: to.Ptr("public"),
// DatabaseName: to.Ptr("postgres"),
// Table: to.Ptr("nation"),
// },
// },
// },
// {
// Name: to.Ptr("Analyze_postgres_public_region"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/table"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/table/recommendations/2"),
// Kind: to.Ptr(""),
// Properties: &armpostgresqlflexibleservers.ObjectRecommendationProperties{
// AnalyzedWorkload: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesAnalyzedWorkload{
// EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// QueryCount: to.Ptr[int32](22),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T19:30:22.123Z"); return t}()),
// },
// EstimatedImpact: []*armpostgresqlflexibleservers.ImpactRecord{
// },
// ImplementationDetails: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesImplementationDetails{
// Method: to.Ptr("SQL"),
// Script: to.Ptr("analyze table public.region"),
// },
// ImprovedQueryIDs: []*int64{
// to.Ptr[int64](3219604056681277400),
// to.Ptr[int64](6171467644166225000),
// to.Ptr[int64](-4753875211349607000)},
// InitialRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// LastRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// RecommendationReason: to.Ptr("Table \"region\" in schema \"public\" is unanalyzed and appears in the following queries: 3219604056681277471, 6171467644166224729, -4753875211349607298"),
// RecommendationType: to.Ptr(armpostgresqlflexibleservers.RecommendationTypeEnum("Analyze")),
// TimesRecommended: to.Ptr[int32](1),
// Details: &armpostgresqlflexibleservers.ObjectRecommendationDetails{
// Schema: to.Ptr("public"),
// DatabaseName: to.Ptr("postgres"),
// Table: to.Ptr("region"),
// },
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Lists available object recommendations.
*
* @summary Lists available object recommendations.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendationsFilteredForAnalyzeTable.json
*/
async function listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const tuningOption = "table";
const recommendationType = "AnalyzeTable";
const options = {
recommendationType,
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const resArray = new Array();
for await (const item of client.tuningOptionsOperations.listRecommendations(
resourceGroupName,
serverName,
tuningOption,
options,
)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendationsFilteredForAnalyzeTable.json
// this example is just showing the usage of "TuningOptions_ListRecommendations" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this PostgreSqlFlexibleServerTuningOptionResource created on azure
// for more information of creating PostgreSqlFlexibleServerTuningOptionResource, please refer to the document of PostgreSqlFlexibleServerTuningOptionResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
string serverName = "exampleserver";
PostgreSqlFlexibleServerTuningOptionType tuningOption = PostgreSqlFlexibleServerTuningOptionType.Table;
ResourceIdentifier postgreSqlFlexibleServerTuningOptionResourceId = PostgreSqlFlexibleServerTuningOptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, tuningOption);
PostgreSqlFlexibleServerTuningOptionResource postgreSqlFlexibleServerTuningOption = client.GetPostgreSqlFlexibleServerTuningOptionResource(postgreSqlFlexibleServerTuningOptionResourceId);
// invoke the operation and iterate over the result
PostgreSqlFlexibleServerRecommendationFilterType? recommendationType = PostgreSqlFlexibleServerRecommendationFilterType.AnalyzeTable;
await foreach (ObjectRecommendation item in postgreSqlFlexibleServerTuningOption.GetRecommendationsAsync(recommendationType: recommendationType))
{
Console.WriteLine($"Succeeded: {item}");
}
Console.WriteLine("Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
{
"value": [
{
"name": "Analyze_postgres_public_nation",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/table",
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/table/recommendations/1",
"kind": "",
"properties": {
"analyzedWorkload": {
"endTime": "2025-06-01T20:30:22.123456Z",
"queryCount": 22,
"startTime": "2025-06-01T19:30:22.123456Z"
},
"estimatedImpact": [],
"implementationDetails": {
"method": "SQL",
"script": "analyze table public.nation"
},
"improvedQueryIds": [
2071439792137543700,
7860150533486302000,
6411979446509506000,
3219604056681277400,
-360410933364310600,
6171467644166225000,
3548728559597612500,
-4753875211349607000,
-8711548294430095000
],
"initialRecommendedTime": "2025-06-01T20:30:22.123456Z",
"lastRecommendedTime": "2025-06-01T20:30:22.123456Z",
"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",
"timesRecommended": 1,
"details": {
"schema": "public",
"databaseName": "postgres",
"table": "nation"
}
}
},
{
"name": "Analyze_postgres_public_region",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/table",
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/table/recommendations/2",
"kind": "",
"properties": {
"analyzedWorkload": {
"endTime": "2025-06-01T20:30:22.123456Z",
"queryCount": 22,
"startTime": "2025-06-01T19:30:22.123456Z"
},
"estimatedImpact": [],
"implementationDetails": {
"method": "SQL",
"script": "analyze table public.region"
},
"improvedQueryIds": [
3219604056681277400,
6171467644166225000,
-4753875211349607000
],
"initialRecommendedTime": "2025-06-01T20:30:22.123456Z",
"lastRecommendedTime": "2025-06-01T20:30:22.123456Z",
"recommendationReason": "Table \"region\" in schema \"public\" is unanalyzed and appears in the following queries: 3219604056681277471, 6171467644166224729, -4753875211349607298",
"recommendationType": "Analyze",
"timesRecommended": 1,
"details": {
"schema": "public",
"databaseName": "postgres",
"table": "region"
}
}
}
]
}
List available table recommendations.
Beispielanforderung
GET https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/table/recommendations?api-version=2025-08-01
import com.azure.resourcemanager.postgresqlflexibleserver.models.TuningOptionParameterEnum;
/**
* Samples for TuningOptionsOperation ListRecommendations.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* TuningOptionsListTableRecommendations.json
*/
/**
* Sample code: List available table recommendations.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void listAvailableTableRecommendations(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.tuningOptionsOperations().listRecommendations("exampleresourcegroup", "exampleserver",
TuningOptionParameterEnum.TABLE, null, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python tuning_options_list_table_recommendations.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.tuning_options.list_recommendations(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
tuning_option="table",
)
for item in response:
print(item)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendations.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendations.json
func ExampleTuningOptionsClient_NewListRecommendationsPager_listAvailableTableRecommendations() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewTuningOptionsClient().NewListRecommendationsPager("exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.TuningOptionParameterEnumTable, &armpostgresqlflexibleservers.TuningOptionsClientListRecommendationsOptions{RecommendationType: nil})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.ObjectRecommendationList = armpostgresqlflexibleservers.ObjectRecommendationList{
// Value: []*armpostgresqlflexibleservers.ObjectRecommendation{
// {
// Name: to.Ptr("Analyze_postgres_public_nation"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/table"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/table/recommendations/1"),
// Kind: to.Ptr(""),
// Properties: &armpostgresqlflexibleservers.ObjectRecommendationProperties{
// AnalyzedWorkload: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesAnalyzedWorkload{
// EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// QueryCount: to.Ptr[int32](22),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T19:30:22.123Z"); return t}()),
// },
// EstimatedImpact: []*armpostgresqlflexibleservers.ImpactRecord{
// },
// ImplementationDetails: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesImplementationDetails{
// Method: to.Ptr("SQL"),
// Script: to.Ptr("analyze table public.nation"),
// },
// ImprovedQueryIDs: []*int64{
// to.Ptr[int64](2071439792137543700),
// to.Ptr[int64](7860150533486302000),
// to.Ptr[int64](6411979446509506000),
// to.Ptr[int64](3219604056681277400),
// to.Ptr[int64](-360410933364310600),
// to.Ptr[int64](6171467644166225000),
// to.Ptr[int64](3548728559597612500),
// to.Ptr[int64](-4753875211349607000),
// to.Ptr[int64](-8711548294430095000)},
// InitialRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// LastRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// RecommendationReason: to.Ptr("Table \"nation\" in schema \"public\" is unanalyzed and appears in the following queries: 2071439792137543669, 7860150533486301820, 6411979446509505239, 3219604056681277471, -360410933364310591, 6171467644166224729, 3548728559597612316, -4753875211349607298, -8711548294430094920"),
// RecommendationType: to.Ptr(armpostgresqlflexibleservers.RecommendationTypeEnum("Analyze")),
// TimesRecommended: to.Ptr[int32](1),
// Details: &armpostgresqlflexibleservers.ObjectRecommendationDetails{
// Schema: to.Ptr("public"),
// DatabaseName: to.Ptr("postgres"),
// Table: to.Ptr("nation"),
// },
// },
// },
// {
// Name: to.Ptr("Analyze_postgres_public_region"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/table"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/table/recommendations/2"),
// Kind: to.Ptr(""),
// Properties: &armpostgresqlflexibleservers.ObjectRecommendationProperties{
// AnalyzedWorkload: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesAnalyzedWorkload{
// EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// QueryCount: to.Ptr[int32](22),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T19:30:22.123Z"); return t}()),
// },
// EstimatedImpact: []*armpostgresqlflexibleservers.ImpactRecord{
// },
// ImplementationDetails: &armpostgresqlflexibleservers.ObjectRecommendationPropertiesImplementationDetails{
// Method: to.Ptr("SQL"),
// Script: to.Ptr("analyze table public.region"),
// },
// ImprovedQueryIDs: []*int64{
// to.Ptr[int64](3219604056681277400),
// to.Ptr[int64](6171467644166225000),
// to.Ptr[int64](-4753875211349607000)},
// InitialRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// LastRecommendedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T20:30:22.123Z"); return t}()),
// RecommendationReason: to.Ptr("Table \"region\" in schema \"public\" is unanalyzed and appears in the following queries: 3219604056681277471, 6171467644166224729, -4753875211349607298"),
// RecommendationType: to.Ptr(armpostgresqlflexibleservers.RecommendationTypeEnum("Analyze")),
// TimesRecommended: to.Ptr[int32](1),
// Details: &armpostgresqlflexibleservers.ObjectRecommendationDetails{
// Schema: to.Ptr("public"),
// DatabaseName: to.Ptr("postgres"),
// Table: to.Ptr("region"),
// },
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Lists available object recommendations.
*
* @summary Lists available object recommendations.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendations.json
*/
async function listAvailableTableRecommendations() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const tuningOption = "table";
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const resArray = new Array();
for await (const item of client.tuningOptionsOperations.listRecommendations(
resourceGroupName,
serverName,
tuningOption,
)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendations.json
// this example is just showing the usage of "TuningOptions_ListRecommendations" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this PostgreSqlFlexibleServerTuningOptionResource created on azure
// for more information of creating PostgreSqlFlexibleServerTuningOptionResource, please refer to the document of PostgreSqlFlexibleServerTuningOptionResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
string serverName = "exampleserver";
PostgreSqlFlexibleServerTuningOptionType tuningOption = PostgreSqlFlexibleServerTuningOptionType.Table;
ResourceIdentifier postgreSqlFlexibleServerTuningOptionResourceId = PostgreSqlFlexibleServerTuningOptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, tuningOption);
PostgreSqlFlexibleServerTuningOptionResource postgreSqlFlexibleServerTuningOption = client.GetPostgreSqlFlexibleServerTuningOptionResource(postgreSqlFlexibleServerTuningOptionResourceId);
// invoke the operation and iterate over the result
await foreach (ObjectRecommendation item in postgreSqlFlexibleServerTuningOption.GetRecommendationsAsync())
{
Console.WriteLine($"Succeeded: {item}");
}
Console.WriteLine("Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
{
"value": [
{
"name": "Analyze_postgres_public_nation",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/table",
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/table/recommendations/1",
"kind": "",
"properties": {
"analyzedWorkload": {
"endTime": "2025-06-01T20:30:22.123456Z",
"queryCount": 22,
"startTime": "2025-06-01T19:30:22.123456Z"
},
"estimatedImpact": [],
"implementationDetails": {
"method": "SQL",
"script": "analyze table public.nation"
},
"improvedQueryIds": [
2071439792137543700,
7860150533486302000,
6411979446509506000,
3219604056681277400,
-360410933364310600,
6171467644166225000,
3548728559597612500,
-4753875211349607000,
-8711548294430095000
],
"initialRecommendedTime": "2025-06-01T20:30:22.123456Z",
"lastRecommendedTime": "2025-06-01T20:30:22.123456Z",
"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",
"timesRecommended": 1,
"details": {
"schema": "public",
"databaseName": "postgres",
"table": "nation"
}
}
},
{
"name": "Analyze_postgres_public_region",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/tuningOptions/table",
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver/tuningOptions/table/recommendations/2",
"kind": "",
"properties": {
"analyzedWorkload": {
"endTime": "2025-06-01T20:30:22.123456Z",
"queryCount": 22,
"startTime": "2025-06-01T19:30:22.123456Z"
},
"estimatedImpact": [],
"implementationDetails": {
"method": "SQL",
"script": "analyze table public.region"
},
"improvedQueryIds": [
3219604056681277400,
6171467644166225000,
-4753875211349607000
],
"initialRecommendedTime": "2025-06-01T20:30:22.123456Z",
"lastRecommendedTime": "2025-06-01T20:30:22.123456Z",
"recommendationReason": "Table \"region\" in schema \"public\" is unanalyzed and appears in the following queries: 3219604056681277471, 6171467644166224729, -4753875211349607298",
"recommendationType": "Analyze",
"timesRecommended": 1,
"details": {
"schema": "public",
"databaseName": "postgres",
"table": "region"
}
}
}
]
}
Definitionen
createdByType
Enumeration
Der Identitätstyp, der die Ressource erstellt hat.
| Wert |
Beschreibung |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
ErrorAdditionalInfo
Objekt
Der Ressourcenverwaltungsfehler zusätzliche Informationen.
| Name |
Typ |
Beschreibung |
|
info
|
object
|
Die zusätzlichen Informationen.
|
|
type
|
string
|
Der zusätzliche Informationstyp.
|
ErrorDetail
Objekt
Das Fehlerdetails.
| Name |
Typ |
Beschreibung |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
Die zusätzlichen Informationen des Fehlers.
|
|
code
|
string
|
Der Fehlercode.
|
|
details
|
ErrorDetail[]
|
Die Fehlerdetails.
|
|
message
|
string
|
Die Fehlermeldung.
|
|
target
|
string
|
Das Fehlerziel.
|
ErrorResponse
Objekt
Fehlerantwort
| Name |
Typ |
Beschreibung |
|
error
|
ErrorDetail
|
Das Fehlerobjekt.
|
ImpactRecord
Objekt
Auswirkungen auf eine Metrik, wenn diese empfohlene Maßnahme angewendet wird.
| Name |
Typ |
Beschreibung |
|
absoluteValue
|
number
(double)
|
Absolutwert.
|
|
dimensionName
|
string
|
Name der Dimension.
|
|
queryId
|
integer
(int64)
|
Optionale Eigenschaft, die zum Speichern des Bezeichners der Abfrage verwendet werden kann, wenn die Metrik für eine bestimmte Abfrage gilt.
|
|
unit
|
string
|
Maßeinheit.
|
ObjectRecommendation
Objekt
Eigenschaften von Objektempfehlungen.
| Name |
Typ |
Beschreibung |
|
id
|
string
(arm-id)
|
Vollqualifizierte Ressourcen-ID für die Ressource. Z. B. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
|
kind
|
string
|
Immer leer.
|
|
name
|
string
|
Der Name der Ressource
|
|
properties.analyzedWorkload
|
ObjectRecommendationPropertiesAnalyzedWorkload
|
Informationen zur Arbeitsauslastung für die empfohlene Maßnahme.
|
|
properties.currentState
|
string
|
Aktueller Status.
|
|
properties.details
|
ObjectRecommendationDetails
|
Empfehlungsdetails für die empfohlene Maßnahme.
|
|
properties.estimatedImpact
|
ImpactRecord[]
|
Geschätzte Auswirkungen dieser empfohlenen Maßnahme.
|
|
properties.implementationDetails
|
ObjectRecommendationPropertiesImplementationDetails
|
Details zur Implementierung der empfohlenen Maßnahme.
|
|
properties.improvedQueryIds
|
integer[]
(int64)
|
Liste der Bezeichner für alle Abfragen, die als verbesserungswürdige Ziele identifiziert wurden, wenn die Empfehlung angewendet wird. Die Liste wird nur für CREATE INDEX-Empfehlungen aufgefüllt.
|
|
properties.initialRecommendedTime
|
string
(date-time)
|
Erstellungszeit (UTC) dieser Empfehlung.
|
|
properties.lastRecommendedTime
|
string
(date-time)
|
Das letzte Mal (UTC), dass diese Empfehlung erstellt wurde.
|
|
properties.recommendationReason
|
string
|
Grund für diese Empfehlung.
|
|
properties.recommendationType
|
RecommendationTypeEnum
|
Geben Sie für diese Empfehlung ein.
|
|
properties.timesRecommended
|
integer
(int32)
|
Anzahl der Fälle, die diese Empfehlung erstellt wurde.
|
|
systemData
|
systemData
|
Azure Resource Manager-Metadaten, die createdBy und modifiedBy-Informationen enthalten.
|
|
type
|
string
|
Der Typ der Ressource. Zum Beispiel "Microsoft. Compute/virtualMachines" oder "Microsoft. Speicher/Speicherkonten"
|
ObjectRecommendationDetails
Objekt
Empfehlungsdetails für die empfohlene Maßnahme.
| Name |
Typ |
Beschreibung |
|
databaseName
|
string
|
Datenbankname.
|
|
includedColumns
|
string[]
|
Enthaltene Spalten im Index.
|
|
indexColumns
|
string[]
|
Index-Spalten.
|
|
indexName
|
string
|
Indexname.
|
|
indexType
|
string
|
Index-Typ.
|
|
schema
|
string
|
Schemaname.
|
|
table
|
string
|
Tabellenname.
|
ObjectRecommendationList
Objekt
Liste der verfügbaren Objektempfehlungen.
| Name |
Typ |
Beschreibung |
|
nextLink
|
string
(uri)
|
Der Link zur nächsten Seite von Elementen
|
|
value
|
ObjectRecommendation[]
|
Die ObjectRecommendation-Artikel auf dieser Seite
|
ObjectRecommendationPropertiesAnalyzedWorkload
Objekt
Informationen zur Arbeitsauslastung für die empfohlene Maßnahme.
| Name |
Typ |
Beschreibung |
|
endTime
|
string
(date-time)
|
Endzeit (UTC) der analysierten Arbeitslast.
|
|
queryCount
|
integer
(int32)
|
Anzahl der Abfragen aus der Workload, die untersucht wurden, um diese Empfehlung zu erstellen. Für DROP INDEX-Empfehlungen ist es 0 (Null).
|
|
startTime
|
string
(date-time)
|
Startzeit (UTC) der analysierten Arbeitslast.
|
ObjectRecommendationPropertiesImplementationDetails
Objekt
Details zur Implementierung der empfohlenen Maßnahme.
| Name |
Typ |
Beschreibung |
|
method
|
string
|
Methode der Umsetzung für Handlungsempfehlungen.
|
|
script
|
string
|
Implementierungsskript für die empfohlene Maßnahme.
|
RecommendationTypeEnum
Enumeration
Geben Sie für diese Empfehlung ein.
| Wert |
Beschreibung |
|
CreateIndex
|
Empfehlung, einen Index zu erstellen, um die Abfrageleistung zu verbessern.
|
|
DropIndex
|
Empfehlung, einen bestehenden Index wegzulassen, weil er doppelt oder ungenutzt ist.
|
|
ReIndex
|
Empfehlung, einen bestehenden ungültigen Index neu zu indexieren.
|
|
AnalyzeTable
|
Empfehlung, eine Tabelle zu analysieren, um die Statistiken für den Abfrageoptimierer zu aktualisieren.
|
RecommendationTypeParameterEnum
Enumeration
Filter für die Empfehlungsliste. Ruft Empfehlungen basierend auf dem Typ ab.
| Wert |
Beschreibung |
|
CreateIndex
|
Empfehlung, einen Index zu erstellen, um die Abfrageleistung zu verbessern.
|
|
DropIndex
|
Empfehlung, einen bestehenden Index wegzulassen, weil er doppelt oder ungenutzt ist.
|
|
ReIndex
|
Empfehlung, einen bestehenden ungültigen Index neu zu indexieren.
|
|
AnalyzeTable
|
Empfehlung, eine Tabelle zu analysieren, um die Statistiken für den Abfrageoptimierer zu aktualisieren.
|
systemData
Objekt
Metadaten zur Erstellung und letzten Änderung der Ressource.
| Name |
Typ |
Beschreibung |
|
createdAt
|
string
(date-time)
|
Der Zeitstempel der Ressourcenerstellung (UTC).
|
|
createdBy
|
string
|
Die Identität, die die Ressource erstellt hat.
|
|
createdByType
|
createdByType
|
Der Identitätstyp, der die Ressource erstellt hat.
|
|
lastModifiedAt
|
string
(date-time)
|
Der Zeitstempel der letzten Änderung der Ressource (UTC)
|
|
lastModifiedBy
|
string
|
Die Identität, die die Ressource zuletzt geändert hat.
|
|
lastModifiedByType
|
createdByType
|
Der Identitätstyp, der die Ressource zuletzt geändert hat.
|
TuningOptionParameterEnum
Enumeration
Der Name der Optimierungsoption.
| Wert |
Beschreibung |
|
index
|
Empfehlungen zum Index.
|
|
table
|
Tabellenbezogene Empfehlungen.
|