Répertorie les recommandations d’objets disponibles.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/recommendations?api-version=2025-08-01
Avec des paramètres facultatifs:
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/recommendations?api-version=2025-08-01&recommendationType={recommendationType}
Paramètres URI
| Nom |
Dans |
Obligatoire |
Type |
Description |
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Nom du groupe de ressources. Le nom ne respecte pas la casse.
|
|
serverName
|
path |
True
|
string
minLength: 3 maxLength: 63 pattern: ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*
|
Le nom du serveur
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
ID de l’abonnement cible. La valeur doit être un UUID.
|
|
tuningOption
|
path |
True
|
TuningOptionParameterEnum
|
Nom de l’option de réglage.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Version de l’API à utiliser pour cette opération.
|
|
recommendationType
|
query |
|
RecommendationTypeParameterEnum
|
Filtre de liste de recommandations. Récupère les recommandations en fonction du type.
|
Réponses
Sécurité
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flux:
implicit
URL d’autorisation:
https://login.microsoftonline.com/common/oauth2/authorize
Étendues
| Nom |
Description |
|
user_impersonation
|
emprunter l’identité de votre compte d’utilisateur
|
Exemples
List available index recommendations, filtered to exclusively get those of CREATE INDEX type.
Exemple de requête
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
Exemple de réponse
{
"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.
Exemple de requête
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
Exemple de réponse
{
"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.
Exemple de requête
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
Exemple de réponse
{
"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.
Exemple de requête
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
Exemple de réponse
{
"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"
}
}
}
]
}
Définitions
createdByType
Énumération
Type d’identité qui a créé la ressource.
| Valeur |
Description |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
ErrorAdditionalInfo
Objet
Informations supplémentaires sur l’erreur de gestion des ressources.
| Nom |
Type |
Description |
|
info
|
object
|
Informations supplémentaires.
|
|
type
|
string
|
Type d’informations supplémentaire.
|
ErrorDetail
Objet
Détail de l’erreur.
| Nom |
Type |
Description |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
Informations supplémentaires sur l’erreur.
|
|
code
|
string
|
Code d’erreur.
|
|
details
|
ErrorDetail[]
|
Détails de l’erreur.
|
|
message
|
string
|
Message d’erreur.
|
|
target
|
string
|
Cible d’erreur.
|
ErrorResponse
Objet
Réponse d’erreur
ImpactRecord
Objet
Impact sur une mesure si cette action recommandée est appliquée.
| Nom |
Type |
Description |
|
absoluteValue
|
number
(double)
|
Valeur absolue.
|
|
dimensionName
|
string
|
Nom de la dimension.
|
|
queryId
|
integer
(int64)
|
Propriété facultative qui peut être utilisée pour stocker l’identificateur de la requête, si la métrique concerne une requête spécifique.
|
|
unit
|
string
|
Unité de dimension.
|
ObjectRecommendation
Objet
Propriétés de recommandation d’objet.
| Nom |
Type |
Description |
|
id
|
string
(arm-id)
|
ID de ressource complet pour la ressource. Par exemple, « /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} »
|
|
kind
|
string
|
Toujours vide.
|
|
name
|
string
|
Nom de la ressource
|
|
properties.analyzedWorkload
|
ObjectRecommendationPropertiesAnalyzedWorkload
|
Informations sur la charge de travail pour l’action recommandée.
|
|
properties.currentState
|
string
|
État actuel.
|
|
properties.details
|
ObjectRecommendationDetails
|
Détails de la recommandation pour l’action recommandée.
|
|
properties.estimatedImpact
|
ImpactRecord[]
|
Estimation de l’impact de cette mesure recommandée.
|
|
properties.implementationDetails
|
ObjectRecommendationPropertiesImplementationDetails
|
Détails de la mise en œuvre de l’action recommandée.
|
|
properties.improvedQueryIds
|
integer[]
(int64)
|
Liste des identificateurs de toutes les requêtes identifiées comme cibles d’amélioration si la recommandation est appliquée. La liste n’est renseignée que pour les recommandations CREATE INDEX.
|
|
properties.initialRecommendedTime
|
string
(date-time)
|
Heure de création (UTC) de cette recommandation.
|
|
properties.lastRecommendedTime
|
string
(date-time)
|
La dernière fois (UTC) que cette recommandation a été produite.
|
|
properties.recommendationReason
|
string
|
Raison de cette recommandation.
|
|
properties.recommendationType
|
RecommendationTypeEnum
|
Tapez pour cette recommandation.
|
|
properties.timesRecommended
|
integer
(int32)
|
Nombre de fois où cette recommandation a été produite.
|
|
systemData
|
systemData
|
Azure Resource Manager : métadonnées contenant des informations createdBy et modifiedBy.
|
|
type
|
string
|
Type de la ressource. Par exemple : « Microsoft. Calcul/virtualMachines » ou « Microsoft. StorageAccounts"
|
ObjectRecommendationDetails
Objet
Détails de la recommandation pour l’action recommandée.
| Nom |
Type |
Description |
|
databaseName
|
string
|
Nom de la base de données.
|
|
includedColumns
|
string[]
|
L’index comprenait des colonnes.
|
|
indexColumns
|
string[]
|
Colonnes d’index.
|
|
indexName
|
string
|
Nom de l’index.
|
|
indexType
|
string
|
Type d’index.
|
|
schema
|
string
|
Nom du schéma.
|
|
table
|
string
|
Nom de la table.
|
ObjectRecommendationList
Objet
Liste des recommandations d’objets disponibles.
| Nom |
Type |
Description |
|
nextLink
|
string
(uri)
|
Le lien vers la page suivante des éléments
|
|
value
|
ObjectRecommendation[]
|
Les éléments ObjectRecommendation sur cette page
|
ObjectRecommendationPropertiesAnalyzedWorkload
Objet
Informations sur la charge de travail pour l’action recommandée.
| Nom |
Type |
Description |
|
endTime
|
string
(date-time)
|
Heure de fin (UTC) de la charge de travail analysée.
|
|
queryCount
|
integer
(int32)
|
Nombre de requêtes de la charge de travail qui ont été examinées pour produire cette recommandation. Pour les recommandations DROP INDEX, c’est 0 (zéro).
|
|
startTime
|
string
(date-time)
|
Heure de début (UTC) de la charge de travail analysée.
|
ObjectRecommendationPropertiesImplementationDetails
Objet
Détails de la mise en œuvre de l’action recommandée.
| Nom |
Type |
Description |
|
method
|
string
|
Méthode de mise en œuvre des mesures recommandées.
|
|
script
|
string
|
Script d’implémentation de l’action recommandée.
|
RecommendationTypeEnum
Énumération
Tapez pour cette recommandation.
| Valeur |
Description |
|
CreateIndex
|
Recommandation de créer un index pour améliorer les performances des requêtes.
|
|
DropIndex
|
Il est recommandé de supprimer un index existant car il est en double ou inutilisé.
|
|
ReIndex
|
Recommandation de réindexer un index invalide existant.
|
|
AnalyzeTable
|
Recommandation d’analyser une table pour mettre à jour les statistiques de l’optimiseur de requêtes.
|
RecommendationTypeParameterEnum
Énumération
Filtre de liste de recommandations. Récupère les recommandations en fonction du type.
| Valeur |
Description |
|
CreateIndex
|
Recommandation de créer un index pour améliorer les performances des requêtes.
|
|
DropIndex
|
Il est recommandé de supprimer un index existant car il est en double ou inutilisé.
|
|
ReIndex
|
Recommandation de réindexer un index invalide existant.
|
|
AnalyzeTable
|
Recommandation d’analyser une table pour mettre à jour les statistiques de l’optimiseur de requêtes.
|
systemData
Objet
Métadonnées relatives à la création et à la dernière modification de la ressource.
| Nom |
Type |
Description |
|
createdAt
|
string
(date-time)
|
Horodatage de la création de ressources (UTC).
|
|
createdBy
|
string
|
Identité qui a créé la ressource.
|
|
createdByType
|
createdByType
|
Type d’identité qui a créé la ressource.
|
|
lastModifiedAt
|
string
(date-time)
|
Horodatage de la dernière modification de ressource (UTC)
|
|
lastModifiedBy
|
string
|
Identité qui a modifié la ressource pour la dernière fois.
|
|
lastModifiedByType
|
createdByType
|
Type d’identité qui a modifié la ressource pour la dernière fois.
|
TuningOptionParameterEnum
Énumération
Nom de l’option de réglage.
| Valeur |
Description |
|
index
|
Recommandations liées à l’index.
|
|
table
|
Des recommandations liées à la table.
|