alloydb-postgres-health

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Usage

使用说明

All scripts can be executed using Node.js. Replace
<param_name>
and
<param_value>
with actual values.
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

参数

NameTypeDescriptionRequiredDefault
schema_namestringOptional: The schema name in which the table is present.No
table_namestringRequired: The table name in which the column is present.Yes
column_namestringOptional: The column name for which the cardinality is to be found. If not provided, cardinality for all columns will be returned.No

名称类型描述必填默认值
schema_namestring可选:表所在的架构名称。
table_namestring必填:列所在的表名称。
column_namestring可选:需要估算基数的列名称。如果未提供,则返回所有列的基数。

get_instance

get_instance

Retrieves details about a specific AlloyDB instance.
获取特定AlloyDB实例的详细信息。

Parameters

参数

NameTypeDescriptionRequiredDefault
projectstringThe GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.No
locationstringThe location of the instance (e.g., 'us-central1').Yes
clusterstringThe ID of the cluster.Yes
instancestringThe ID of the instance.Yes

名称类型描述必填默认值
projectstringGCP项目ID。此参数已预先配置;除非用户明确提供不同的ID,否则无需询问。
locationstring实例所在位置(例如:'us-central1')。
clusterstring集群ID。
instancestring实例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

参数

NameTypeDescriptionRequiredDefault
schema_namestringOptional: A specific schema name to filter byNo
table_namestringOptional: A specific table name to filter byNo
ownerstringOptional: A specific owner to filter byNo
sort_bystringOptional: The column to sort byNo
limitintegerOptional: The maximum number of results to returnNo
50

名称类型描述必填默认值
schema_namestring可选:用于过滤的特定架构名称
table_namestring可选:用于过滤的特定表名称
ownerstring可选:用于过滤的特定所有者
sort_bystring可选:排序依据的列
limitinteger可选:返回结果的最大数量
50

list_tablespaces

list_tablespaces

Parameters

参数

NameTypeDescriptionRequiredDefault
tablespace_namestringOptional: a text to filter results by tablespace name. The input is used within a LIKE clause.No``
limitintegerOptional: The maximum number of rows to return.No
50

名称类型描述必填默认值
tablespace_namestring可选:用于按表空间名称过滤结果的文本。输入将用于LIKE子句中。``
limitinteger可选:返回结果的最大行数。
50

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

参数

NameTypeDescriptionRequiredDefault
limitintegerThe maximum number of results to return.No
50

名称类型描述必填默认值
limitinteger返回结果的最大数量。
50