可以通过 az postgres flexible-server index-tuning show-settings 命令在现有服务器中显示单个索引优化设置的值。
例如,若要显示调用 analyze_interval的索引优化设置的值,请使用以下命令:
az postgres flexible-server index-tuning show-settings \
--resource-group <resource_group> \
--server-name <server> \
--name analyze_interval
该命令返回与该索引优化设置对应的服务器参数的所有信息,输出类似于以下内容:
{
"allowedValues": "60-10080",
"dataType": "Integer",
"defaultValue": "720",
"description": "Sets the frequency at which each index optimization session is triggered when index_tuning.mode is set to 'REPORT'.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2274149",
"id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DBforPostgreSQL/flexibleServers/<server>/configurations/index_tuning.analysis_interval",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "index_tuning.analysis_interval",
"resourceGroup": "<resource_group>",
"source": "user-override",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": "minutes",
"value": "720"
}
此外,还可以通过 az postgres flexible-server index-tuning list-settings 命令显示现有服务器中所有索引优化设置的列表。
若要列出所有索引优化设置,请使用以下命令:
az postgres flexible-server index-tuning list-settings \
--resource-group <resource_group> \
--server-name <server>
该命令返回控制索引优化的不同设置的所有服务器参数,输出如下所示:
[
{
"allowedValues": "60-10080",
"dataType": "Integer",
"defaultValue": "720",
"description": "Sets the frequency at which each index optimization session is triggered when index_tuning.mode is set to 'REPORT'.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2274149",
"id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DBforPostgreSQL/flexibleServers/<server>/configurations/index_tuning.analysis_interval",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "index_tuning.analysis_interval",
"resourceGroup": "<resource_group>",
"source": "user-override",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": "minutes",
"value": "720"
},
{
"allowedValues": "1-10",
"dataType": "Integer",
"defaultValue": "2",
"description": "Maximum number of columns that can be part of the index key for any recommended index.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2274149",
"id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DBforPostgreSQL/flexibleServers/<server>/configurations/index_tuning.max_columns_per_index",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "index_tuning.max_columns_per_index",
"resourceGroup": "<resource_group>",
"source": "system-default",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": null,
"value": "2"
},
{
"allowedValues": "1-25",
"dataType": "Integer",
"defaultValue": "10",
"description": "Maximum number of indexes that can be recommended for each database during one optimization session.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2274149",
"id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DBforPostgreSQL/flexibleServers/<server>/configurations/index_tuning.max_index_count",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "index_tuning.max_index_count",
"resourceGroup": "<resource_group>",
"source": "system-default",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": null,
"value": "10"
},
{
"allowedValues": "1-25",
"dataType": "Integer",
"defaultValue": "10",
"description": "Maximum number of indexes that can be recommended for each table.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2274149",
"id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DBforPostgreSQL/flexibleServers/<server>/configurations/index_tuning.max_indexes_per_table",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "index_tuning.max_indexes_per_table",
"resourceGroup": "<resource_group>",
"source": "system-default",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": null,
"value": "10"
},
{
"allowedValues": "5-100",
"dataType": "Integer",
"defaultValue": "25",
"description": "Number of slowest queries per database for which indexes can be recommended.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2274149",
"id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DBforPostgreSQL/flexibleServers/<server>/configurations/index_tuning.max_queries_per_database",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "index_tuning.max_queries_per_database",
"resourceGroup": "<resource_group>",
"source": "system-default",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": null,
"value": "25"
},
{
"allowedValues": "0.05-0.2",
"dataType": "Numeric",
"defaultValue": "0.1",
"description": "Acceptable regression introduced by a recommended index on any of the queries analyzed during one optimization session.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2274149",
"id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DBforPostgreSQL/flexibleServers/<server>/configurations/index_tuning.max_regression_factor",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "index_tuning.max_regression_factor",
"resourceGroup": "<resource_group>",
"source": "system-default",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": "percentage",
"value": "0.1"
},
{
"allowedValues": "0-1.0",
"dataType": "Numeric",
"defaultValue": "0.1",
"description": "Maximum total size, in percentage of total disk space, that all recommended indexes for any given database can use.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2274149",
"id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DBforPostgreSQL/flexibleServers/<server>/configurations/index_tuning.max_total_size_factor",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "index_tuning.max_total_size_factor",
"resourceGroup": "<resource_group>",
"source": "system-default",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": "percentage",
"value": "0.1"
},
{
"allowedValues": "0-20.0",
"dataType": "Numeric",
"defaultValue": "0.2",
"description": "Cost improvement that a recommended index must provide to at least one of the queries analyzed during one optimization session.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2274149",
"id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DBforPostgreSQL/flexibleServers/<server>/configurations/index_tuning.min_improvement_factor",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "index_tuning.min_improvement_factor",
"resourceGroup": "<resource_group>",
"source": "system-default",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": "percentage",
"value": "0.2"
},
{
"allowedValues": "off,report",
"dataType": "Enumeration",
"defaultValue": "off",
"description": "Configures index optimization as disabled ('OFF') or enabled to only emit recommendation. Requires Query Store to be enabled by setting pg_qs.query_capture_mode to 'TOP' or 'ALL'.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2274149",
"id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DBforPostgreSQL/flexibleServers/<server>/configurations/index_tuning.mode",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "index_tuning.mode",
"resourceGroup": "<resource_group>",
"source": "user-override",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": null,
"value": "off"
},
{
"allowedValues": "0-9999999",
"dataType": "Integer",
"defaultValue": "1000",
"description": "Minimum number of daily average DML operations affecting the table, so that their unused indexes are considered for dropping.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2274149",
"id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DBforPostgreSQL/flexibleServers/<server>/configurations/index_tuning.unused_dml_per_table",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "index_tuning.unused_dml_per_table",
"resourceGroup": "<resource_group>",
"source": "system-default",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": null,
"value": "1000"
},
{
"allowedValues": "30-720",
"dataType": "Integer",
"defaultValue": "35",
"description": "Minimum number of days the index has not been used, based on system statistics, so that it is considered for dropping.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2274149",
"id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DBforPostgreSQL/flexibleServers/<server>/configurations/index_tuning.unused_min_period",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "index_tuning.unused_min_period",
"resourceGroup": "<resource_group>",
"source": "system-default",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": "days",
"value": "35"
},
{
"allowedValues": "0-9999999",
"dataType": "Integer",
"defaultValue": "1000",
"description": "Minimum number of daily average read operations affecting the table, so that their unused indexes are considered for dropping.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2274149",
"id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DBforPostgreSQL/flexibleServers/<server>/configurations/index_tuning.unused_reads_per_table",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "index_tuning.unused_reads_per_table",
"resourceGroup": "<resource_group>",
"source": "system-default",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": null,
"value": "1000"
}
]