alloydb-postgres-health
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUsage
使用说明
All scripts can be executed using Node.js. Replace and with actual values.
<param_name><param_value>Bash:
node <skill_dir>/scripts/<script_name>.js '{"<param_name>": "<param_value>"}'PowerShell:
node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'Note: The scripts automatically load the environment variables from various .env files. Do not ask the user to set vars unless skill executions fails due to env var absence.
所有脚本均可通过Node.js执行。将和替换为实际值。
<param_name><param_value>Bash:
node <skill_dir>/scripts/<script_name>.js '{"<param_name>": "<param_value>"}'PowerShell:
node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'Note: 脚本会自动从多个.env文件加载环境变量。除非因缺少环境变量导致技能执行失败,否则无需要求用户设置变量。
Scripts
脚本
database_overview
database_overview
Fetches the current state of the PostgreSQL server, returning the version, whether it's a replica, uptime duration, maximum connection limit, number of current connections, number of active connections, and the percentage of connections in use.
获取PostgreSQL服务器的当前状态,返回版本信息、是否为副本实例、运行时长、最大连接限制、当前连接数、活跃连接数以及连接使用率百分比。
get_column_cardinality
get_column_cardinality
Estimates the number of unique values (cardinality) quickly for one or all columns in a specific PostgreSQL table by using the database's internal statistics, returning the results in descending order of estimated cardinality. Please run ANALYZE on the table before using this tool to get accurate results. The tool returns the column_name and the estimated_cardinality. If the column_name is not provided, the tool returns all columns along with their estimated cardinality.
通过数据库内部统计信息快速估算特定PostgreSQL表中单个或所有列的唯一值数量(基数),并按估算基数降序返回结果。使用此工具前,请先对表执行ANALYZE以获取准确结果。工具会返回column_name和estimated_cardinality。如果未提供column_name,则返回所有列及其估算基数。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| schema_name | string | Optional: The schema name in which the table is present. | No | |
| table_name | string | Required: The table name in which the column is present. | Yes | |
| column_name | string | Optional: The column name for which the cardinality is to be found. If not provided, cardinality for all columns will be returned. | No |
| 名称 | 类型 | 描述 | 必填 | 默认值 |
|---|---|---|---|---|
| schema_name | string | 可选:表所在的架构名称。 | 否 | |
| table_name | string | 必填:列所在的表名称。 | 是 | |
| column_name | string | 可选:需要估算基数的列名称。如果未提供,则返回所有列的基数。 | 否 |
get_instance
get_instance
Retrieves details about a specific AlloyDB instance.
获取特定AlloyDB实例的详细信息。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | |
| location | string | The location of the instance (e.g., 'us-central1'). | Yes | |
| cluster | string | The ID of the cluster. | Yes | |
| instance | string | The ID of the instance. | Yes |
| 名称 | 类型 | 描述 | 必填 | 默认值 |
|---|---|---|---|---|
| project | string | GCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则无需询问。 | 否 | |
| location | string | 实例所在位置(例如:'us-central1')。 | 是 | |
| cluster | string | 集群ID。 | 是 | |
| instance | string | 实例ID。 | 是 |
list_autovacuum_configurations
list_autovacuum_configurations
List PostgreSQL autovacuum-related configurations (name and current setting) from pg_settings.
从pg_settings中列出PostgreSQL与autovacuum相关的配置(名称和当前设置)。
list_invalid_indexes
list_invalid_indexes
Lists all invalid PostgreSQL indexes which are taking up disk space but are unusable by the query planner. Typically created by failed CREATE INDEX CONCURRENTLY operations.
列出所有无效的PostgreSQL索引,这些索引占用磁盘空间但无法被查询规划器使用。通常由失败的CREATE INDEX CONCURRENTLY操作创建。
list_table_stats
list_table_stats
Lists the user table statistics in the database ordered by number of
sequential scans with a default limit of 50 rows. Returns the following
columns: schema name, table name, table size in bytes, number of
sequential scans, number of index scans, idx_scan_ratio_percent (showing
the percentage of total scans that utilized an index, where a low ratio
indicates missing or ineffective indexes), number of live rows, number
of dead rows, dead_row_ratio_percent (indicating potential table bloat),
total number of rows inserted, updated, and deleted, the timestamps
for the last_vacuum, last_autovacuum, and last_autoanalyze operations.
按顺序扫描次数排序列出数据库中的用户表统计信息,默认返回50行。返回以下列:架构名称、表名称、表大小(字节)、顺序扫描次数、索引扫描次数、idx_scan_ratio_percent(显示使用索引的扫描占总扫描的百分比,比率低表示缺少或无效索引)、活跃行数、死行数、dead_row_ratio_percent(表示潜在的表膨胀)、插入、更新和删除的总行数,以及last_vacuum、last_autovacuum和last_autoanalyze操作的时间戳。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| schema_name | string | Optional: A specific schema name to filter by | No | |
| table_name | string | Optional: A specific table name to filter by | No | |
| owner | string | Optional: A specific owner to filter by | No | |
| sort_by | string | Optional: The column to sort by | No | |
| limit | integer | Optional: The maximum number of results to return | No | |
| 名称 | 类型 | 描述 | 必填 | 默认值 |
|---|---|---|---|---|
| schema_name | string | 可选:用于过滤的特定架构名称 | 否 | |
| table_name | string | 可选:用于过滤的特定表名称 | 否 | |
| owner | string | 可选:用于过滤的特定所有者 | 否 | |
| sort_by | string | 可选:排序依据的列 | 否 | |
| limit | integer | 可选:返回结果的最大数量 | 否 | |
list_tablespaces
list_tablespaces
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| tablespace_name | string | Optional: a text to filter results by tablespace name. The input is used within a LIKE clause. | No | `` |
| limit | integer | Optional: The maximum number of rows to return. | No | |
| 名称 | 类型 | 描述 | 必填 | 默认值 |
|---|---|---|---|---|
| tablespace_name | string | 可选:用于按表空间名称过滤结果的文本。输入将用于LIKE子句中。 | 否 | `` |
| limit | integer | 可选:返回结果的最大行数。 | 否 | |
list_top_bloated_tables
list_top_bloated_tables
List the top tables by dead-tuple (approximate bloat signal), returning schema, table, live/dead tuples, percentage, and last vacuum/analyze times.
按死元组(近似膨胀信号)列出排名靠前的表,返回架构、表、活跃/死元组、百分比以及最后一次vacuum/analyze的时间。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| limit | integer | The maximum number of results to return. | No | |
| 名称 | 类型 | 描述 | 必填 | 默认值 |
|---|---|---|---|---|
| limit | integer | 返回结果的最大数量。 | 否 | |