Elenca i consigli sugli oggetti disponibili.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/recommendations?api-version=2025-08-01
Con parametri facoltativi:
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/recommendations?api-version=2025-08-01&recommendationType={recommendationType}
Parametri dell'URI
| Nome |
In |
Necessario |
Tipo |
Descrizione |
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Nome del gruppo di risorse. Il nome è insensibile alle maiuscole e minuscole.
|
|
serverName
|
path |
True
|
string
minLength: 3 maxLength: 63 pattern: ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*
|
Il nome del server.
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
ID della sottoscrizione di destinazione. Il valore deve essere un UUID.
|
|
tuningOption
|
path |
True
|
TuningOptionParameterEnum
|
Nome dell'opzione di ottimizzazione.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Versione dell'API da usare per questa operazione.
|
|
recommendationType
|
query |
|
RecommendationTypeParameterEnum
|
Filtro elenco raccomandazioni. Recupera le raccomandazioni in base al tipo.
|
Risposte
Sicurezza
azure_auth
Azure Active Directory OAuth2 Flow.
Tipo:
oauth2
Flow:
implicit
URL di autorizzazione:
https://login.microsoftonline.com/common/oauth2/authorize
Ambiti
| Nome |
Descrizione |
|
user_impersonation
|
rappresentare l'account utente
|
Esempio
List available index recommendations, filtered to exclusively get those of CREATE INDEX type.
Esempio di richiesta
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://learn.microsoft.com/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
Risposta di esempio
{
"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.
Esempio di richiesta
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://learn.microsoft.com/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
Risposta di esempio
{
"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.
Esempio di richiesta
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://learn.microsoft.com/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
Risposta di esempio
{
"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.
Esempio di richiesta
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://learn.microsoft.com/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
Risposta di esempio
{
"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"
}
}
}
]
}
Definizioni
createdByType
Enumerazione
Tipo di identità che ha creato la risorsa.
| Valore |
Descrizione |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
ErrorAdditionalInfo
Oggetto
Informazioni aggiuntive sull'errore di gestione delle risorse.
| Nome |
Tipo |
Descrizione |
|
info
|
object
|
Informazioni aggiuntive.
|
|
type
|
string
|
Tipo di informazioni aggiuntive.
|
ErrorDetail
Oggetto
Dettagli dell'errore.
| Nome |
Tipo |
Descrizione |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
Informazioni aggiuntive sull'errore.
|
|
code
|
string
|
Codice di errore.
|
|
details
|
ErrorDetail[]
|
Dettagli dell'errore.
|
|
message
|
string
|
Messaggio di errore.
|
|
target
|
string
|
Destinazione dell'errore.
|
ErrorResponse
Oggetto
Risposta di errore
ImpactRecord
Oggetto
Impatto su alcune metriche se viene applicata questa azione consigliata.
| Nome |
Tipo |
Descrizione |
|
absoluteValue
|
number
(double)
|
Valore assoluto.
|
|
dimensionName
|
string
|
Nome dimensione.
|
|
queryId
|
integer
(int64)
|
Proprietà facoltativa che può essere utilizzata per archiviare l'identificatore della query, se la metrica è per una query specifica.
|
|
unit
|
string
|
Unità di quota.
|
ObjectRecommendation
Oggetto
Proprietà dei consigli sugli oggetti.
| Nome |
Tipo |
Descrizione |
|
id
|
string
(arm-id)
|
ID risorsa completo per la risorsa. Ad esempio, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
|
kind
|
string
|
Sempre vuoto.
|
|
name
|
string
|
Nome della risorsa
|
|
properties.analyzedWorkload
|
ObjectRecommendationPropertiesAnalyzedWorkload
|
Informazioni sul carico di lavoro per l'azione consigliata.
|
|
properties.currentState
|
string
|
Stato attuale.
|
|
properties.details
|
ObjectRecommendationDetails
|
Dettagli della raccomandazione per l'azione consigliata.
|
|
properties.estimatedImpact
|
ImpactRecord[]
|
Impatto stimato dell'azione raccomandata.
|
|
properties.implementationDetails
|
ObjectRecommendationPropertiesImplementationDetails
|
Dettagli di implementazione per l'azione consigliata.
|
|
properties.improvedQueryIds
|
integer[]
(int64)
|
Elenco di identificatori per tutte le query identificate come obiettivi di miglioramento se viene applicata la raccomandazione. L'elenco viene popolato solo per le raccomandazioni CREATE INDEX.
|
|
properties.initialRecommendedTime
|
string
(date-time)
|
Ora di creazione (UTC) di questa raccomandazione.
|
|
properties.lastRecommendedTime
|
string
(date-time)
|
L'ultima volta (UTC) che questa raccomandazione è stata prodotta.
|
|
properties.recommendationReason
|
string
|
Motivo di questa raccomandazione.
|
|
properties.recommendationType
|
RecommendationTypeEnum
|
Digitare per questa raccomandazione.
|
|
properties.timesRecommended
|
integer
(int32)
|
Numero di volte in cui questa raccomandazione è stata prodotta.
|
|
systemData
|
systemData
|
Azure Resource Manager metadati contenenti informazioni createBy e modifiedBy.
|
|
type
|
string
|
Tipo di risorsa. Ad esempio: "Microsoft. Compute/virtualMachines" oppure "Microsoft. Storage/storageAccounts"
|
ObjectRecommendationDetails
Oggetto
Dettagli della raccomandazione per l'azione consigliata.
| Nome |
Tipo |
Descrizione |
|
databaseName
|
string
|
Nome del database.
|
|
includedColumns
|
string[]
|
Colonne incluse nell'indice.
|
|
indexColumns
|
string[]
|
Colonne dell'indice.
|
|
indexName
|
string
|
Nome dell'indice.
|
|
indexType
|
string
|
Tipo di indice.
|
|
schema
|
string
|
Nome schema.
|
|
table
|
string
|
Nome della tabella.
|
ObjectRecommendationList
Oggetto
Elenco dei consigli sugli oggetti disponibili.
| Nome |
Tipo |
Descrizione |
|
nextLink
|
string
(uri)
|
Il link alla pagina successiva degli elementi
|
|
value
|
ObjectRecommendation[]
|
Gli elementi ObjectRecommendation in questa pagina
|
ObjectRecommendationPropertiesAnalyzedWorkload
Oggetto
Informazioni sul carico di lavoro per l'azione consigliata.
| Nome |
Tipo |
Descrizione |
|
endTime
|
string
(date-time)
|
Ora di fine (UTC) del carico di lavoro analizzato.
|
|
queryCount
|
integer
(int32)
|
Numero di query del carico di lavoro esaminate per produrre questa raccomandazione. Per le raccomandazioni DROP INDEX è 0 (zero).
|
|
startTime
|
string
(date-time)
|
Ora di inizio (UTC) del carico di lavoro analizzato.
|
ObjectRecommendationPropertiesImplementationDetails
Oggetto
Dettagli di implementazione per l'azione consigliata.
| Nome |
Tipo |
Descrizione |
|
method
|
string
|
Metodo di attuazione dell'azione raccomandata.
|
|
script
|
string
|
Script di implementazione per l'azione consigliata.
|
RecommendationTypeEnum
Enumerazione
Digitare per questa raccomandazione.
| Valore |
Descrizione |
|
CreateIndex
|
Raccomandazione di creare un indice per migliorare le prestazioni delle query.
|
|
DropIndex
|
Consiglio di eliminare un indice esistente perché è duplicato o inutilizzato.
|
|
ReIndex
|
Raccomandazione di reindicizzare un indice invalido esistente.
|
|
AnalyzeTable
|
Raccomandazione di analizzare una tabella per aggiornare le statistiche dell'ottimizzatore di query.
|
RecommendationTypeParameterEnum
Enumerazione
Filtro elenco raccomandazioni. Recupera le raccomandazioni in base al tipo.
| Valore |
Descrizione |
|
CreateIndex
|
Raccomandazione di creare un indice per migliorare le prestazioni delle query.
|
|
DropIndex
|
Consiglio di eliminare un indice esistente perché è duplicato o inutilizzato.
|
|
ReIndex
|
Raccomandazione di reindicizzare un indice invalido esistente.
|
|
AnalyzeTable
|
Raccomandazione di analizzare una tabella per aggiornare le statistiche dell'ottimizzatore di query.
|
systemData
Oggetto
Metadati relativi alla creazione e all'ultima modifica della risorsa.
| Nome |
Tipo |
Descrizione |
|
createdAt
|
string
(date-time)
|
Timestamp della creazione della risorsa (UTC).
|
|
createdBy
|
string
|
Identità che ha creato la risorsa.
|
|
createdByType
|
createdByType
|
Tipo di identità che ha creato la risorsa.
|
|
lastModifiedAt
|
string
(date-time)
|
Timestamp dell'ultima modifica della risorsa (UTC)
|
|
lastModifiedBy
|
string
|
Identità che ha modificato l'ultima volta la risorsa.
|
|
lastModifiedByType
|
createdByType
|
Tipo di identità che ha modificato l'ultima volta la risorsa.
|
TuningOptionParameterEnum
Enumerazione
Nome dell'opzione di ottimizzazione.
| Valore |
Descrizione |
|
index
|
Raccomandazioni relative all'indice.
|
|
table
|
Raccomandazioni relative ai tavoli.
|