From 90d77e083cdab16a5a7ae8640ef05ec0bfe714b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B3=BD=E6=B5=A9?= <266632325+Loyal-Young@users.noreply.github.com> Date: Tue, 24 Nov 2026 01:02:20 +0800 Subject: [PATCH] docs: align VACUUM progress counters with v5.6 Fixes #479. Assisted-by: Codex:GPT-6 Percentage of AI-generated code: 100% --- CN/modules/ROOT/pages/3.2.adoc | 20 +++++++++++++++++--- EN/modules/ROOT/pages/3.2.adoc | 20 +++++++++++++++++--- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/CN/modules/ROOT/pages/3.2.adoc b/CN/modules/ROOT/pages/3.2.adoc index 2ff69046..ee80b0b7 100644 --- a/CN/modules/ROOT/pages/3.2.adoc +++ b/CN/modules/ROOT/pages/3.2.adoc @@ -942,9 +942,23 @@ IvorySQL具有在命令执行过程中报告某些命令进度的能力。 目 | heap_blks_scanned | bigint | 被扫描的堆块数量。由于visibility map被用来优化扫描,一些块将被跳过而不做检查,被跳过的块会被包括在这个总数中,因此当清理完成时这个数字最终将会等于heap_blks_total。仅当处于扫描堆阶段时这个计数器才会前进。 | heap_blks_vacuumed | bigint | 被清理的堆块数量。除非表没有索引,这个计数器仅在处于清理堆阶段时才会前进。不包含死亡元组的块会被跳过,因此这个计数器可能有时会向前跳跃一个比较大的增量。 | index_vacuum_count | bigint | 已完成的索引清理周期数。 -| max_dead_tuples | bigint | 在需要执行一个索引清理周期之前我们可以存储的死亡元组数,取决于maintenance_work_mem。 -| num_dead_tuples | bigint | 从上一个索引清理周期以来收集的死亡元组数。 -|==== +| max_dead_tuple_bytes | bigint | 开始下一次索引清理周期前可用于保存死亡元组标识的内存上限,单位为字节。 +| dead_tuple_bytes | bigint | 当前保存死亡元组标识所占的内存,单位为字节。 +| num_dead_item_ids | bigint | 从上一个索引清理周期以来收集的死亡项标识数量。 +| indexes_total | bigint | 当前索引清理或收尾阶段需要处理的索引数。 +| indexes_processed | bigint | 当前阶段已经处理的索引数。 +| delay_time | double precision | 基于代价的延迟所消耗的毫秒数,启用 `track_cost_delay_timing` 时报告。 +|==== + +查询时分别读取内存用量和项数量。每个正在运行的清理进程在视图中对应一行。 + +[source,sql] +---- +SELECT pid, relid::regclass, phase, + max_dead_tuple_bytes, dead_tuple_bytes, num_dead_item_ids, + indexes_total, indexes_processed, delay_time +FROM pg_stat_progress_vacuum; +---- **表37.VACUUM的阶段** |==== diff --git a/EN/modules/ROOT/pages/3.2.adoc b/EN/modules/ROOT/pages/3.2.adoc index 789859c1..745cd486 100644 --- a/EN/modules/ROOT/pages/3.2.adoc +++ b/EN/modules/ROOT/pages/3.2.adoc @@ -1060,9 +1060,23 @@ Whenever `VACUUM` is running, the `pg_stat_progress_vacuum` view will contain on | `heap_blks_scanned` | `bigint` | Number of heap blocks scanned. Because the https://www.postgresql.org/docs/current/storage-vm.html[visibility map] is used to optimize scans, some blocks will be skipped without inspection; skipped blocks are included in this total, so that this number will eventually become equal to `heap_blks_total` when the vacuum is complete. This counter only advances when the phase is `scanning heap`. | | `heap_blks_vacuumed` | `bigint` | Number of heap blocks vacuumed. Unless the table has no indexes, this counter only advances when the phase is `vacuuming heap`. Blocks that contain no dead tuples are skipped, so the counter may sometimes skip forward in large increments. | | `index_vacuum_count` | `bigint` | Number of completed index vacuum cycles. | -| `max_dead_tuples` | `bigint` | Number of dead tuples that we can store before needing to perform an index vacuum cycle, based on https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-MAINTENANCE-WORK-MEM[maintenance_work_mem]. | -| `num_dead_tuples` | `bigint` | Number of dead tuples collected since the last index vacuum cycle. | -|==== +| `max_dead_tuple_bytes` | `bigint` | Memory available to store dead tuple identifiers before another index vacuum cycle is needed, in bytes. | +| `dead_tuple_bytes` | `bigint` | Memory currently used to store dead tuple identifiers, in bytes. | +| `num_dead_item_ids` | `bigint` | Dead item identifiers collected since the last index vacuum cycle. | +| `indexes_total` | `bigint` | Number of indexes to process in the current index vacuum or cleanup phase. | +| `indexes_processed` | `bigint` | Number of indexes processed in the current phase. | +| `delay_time` | `double precision` | Milliseconds spent in cost-based delay, reported when `track_cost_delay_timing` is enabled. | +|==== + +Query the memory and item-count fields separately. The view returns a row for each running vacuum. + +[source,sql] +---- +SELECT pid, relid::regclass, phase, + max_dead_tuple_bytes, dead_tuple_bytes, num_dead_item_ids, + indexes_total, indexes_processed, delay_time +FROM pg_stat_progress_vacuum; +---- .**VACUUM Phases** |====