pg_stat_progress_vacuum

提供有关vacuum操作信息的进度报告视图

pg_stat_progress_vacuum 是一个提供有关vacuum操作进度信息的进度报告视图(无论是由VACUUM命令手动触发还是由autovacuum自动触发)。

pg_stat_progress_vacuumPostgreSQL 9.6中添加。

用法

pg_stat_progress_vacuum 将为每个当前的vacuum操作包含一行,并在操作过程中更新。当前阶段在phase字段中报告,并且将是以下值之一

  • 初始化
  • 扫描堆
  • 清理索引
  • 清理堆
  • 清理索引
  • 截断堆
  • 执行最终清理

有关每个阶段的更多详细信息,请参阅PostgreSQL文档中的表VACUUM阶段

VACUUM FULL

请注意,VACUUM FULL的进度通过pg_stat_progress_cluster视图报告。

PostgreSQL版本定义

pg_stat_progress_vacuum (PostgreSQL 17)

            View "pg_catalog.pg_stat_progress_vacuum"
        Column        |  Type   | Collation | Nullable | Default 
----------------------+---------+-----------+----------+---------
 pid                  | integer |           |          | 
 datid                | oid     |           |          | 
 datname              | name    |           |          | 
 relid                | oid     |           |          | 
 phase                | text    |           |          | 
 heap_blks_total      | bigint  |           |          | 
 heap_blks_scanned    | bigint  |           |          | 
 heap_blks_vacuumed   | bigint  |           |          | 
 index_vacuum_count   | bigint  |           |          | 
 max_dead_tuple_bytes | bigint  |           |          | 
 dead_tuple_bytes     | bigint  |           |          | 
 indexes_total        | bigint  |           |          | 
 indexes_processed    | bigint  |           |          |
    

文档: pg_stat_progress_vacuum

pg_stat_progress_vacuum (PostgreSQL 16)

           View "pg_catalog.pg_stat_progress_vacuum"
       Column       |  Type   | Collation | Nullable | Default 
--------------------+---------+-----------+----------+---------
 pid                | integer |           |          | 
 datid              | oid     |           |          | 
 datname            | name    |           |          | 
 relid              | oid     |           |          | 
 phase              | text    |           |          | 
 heap_blks_total    | bigint  |           |          | 
 heap_blks_scanned  | bigint  |           |          | 
 heap_blks_vacuumed | bigint  |           |          | 
 index_vacuum_count | bigint  |           |          | 
 max_dead_tuples    | bigint  |           |          | 
 num_dead_tuples    | bigint  |           |          |
    

文档: pg_stat_progress_vacuum

pg_stat_progress_vacuum (PostgreSQL 15)

           View "pg_catalog.pg_stat_progress_vacuum"
       Column       |  Type   | Collation | Nullable | Default 
--------------------+---------+-----------+----------+---------
 pid                | integer |           |          | 
 datid              | oid     |           |          | 
 datname            | name    |           |          | 
 relid              | oid     |           |          | 
 phase              | text    |           |          | 
 heap_blks_total    | bigint  |           |          | 
 heap_blks_scanned  | bigint  |           |          | 
 heap_blks_vacuumed | bigint  |           |          | 
 index_vacuum_count | bigint  |           |          | 
 max_dead_tuples    | bigint  |           |          | 
 num_dead_tuples    | bigint  |           |          |
    

文档: pg_stat_progress_vacuum

pg_stat_progress_vacuum (PostgreSQL 14)

           View "pg_catalog.pg_stat_progress_vacuum"
       Column       |  Type   | Collation | Nullable | Default 
--------------------+---------+-----------+----------+---------
 pid                | integer |           |          | 
 datid              | oid     |           |          | 
 datname            | name    |           |          | 
 relid              | oid     |           |          | 
 phase              | text    |           |          | 
 heap_blks_total    | bigint  |           |          | 
 heap_blks_scanned  | bigint  |           |          | 
 heap_blks_vacuumed | bigint  |           |          | 
 index_vacuum_count | bigint  |           |          | 
 max_dead_tuples    | bigint  |           |          | 
 num_dead_tuples    | bigint  |           |          |
    

文档: pg_stat_progress_vacuum

pg_stat_progress_vacuum (PostgreSQL 13)

           View "pg_catalog.pg_stat_progress_vacuum"
       Column       |  Type   | Collation | Nullable | Default 
--------------------+---------+-----------+----------+---------
 pid                | integer |           |          | 
 datid              | oid     |           |          | 
 datname            | name    |           |          | 
 relid              | oid     |           |          | 
 phase              | text    |           |          | 
 heap_blks_total    | bigint  |           |          | 
 heap_blks_scanned  | bigint  |           |          | 
 heap_blks_vacuumed | bigint  |           |          | 
 index_vacuum_count | bigint  |           |          | 
 max_dead_tuples    | bigint  |           |          | 
 num_dead_tuples    | bigint  |           |          |
    

文档: pg_stat_progress_vacuum

pg_stat_progress_vacuum (PostgreSQL 12)

           View "pg_catalog.pg_stat_progress_vacuum"
       Column       |  Type   | Collation | Nullable | Default 
--------------------+---------+-----------+----------+---------
 pid                | integer |           |          | 
 datid              | oid     |           |          | 
 datname            | name    |           |          | 
 relid              | oid     |           |          | 
 phase              | text    |           |          | 
 heap_blks_total    | bigint  |           |          | 
 heap_blks_scanned  | bigint  |           |          | 
 heap_blks_vacuumed | bigint  |           |          | 
 index_vacuum_count | bigint  |           |          | 
 max_dead_tuples    | bigint  |           |          | 
 num_dead_tuples    | bigint  |           |          |
    

文档: pg_stat_progress_vacuum

pg_stat_progress_vacuum (PostgreSQL 11)

           View "pg_catalog.pg_stat_progress_vacuum"
       Column       |  Type   | Collation | Nullable | Default 
--------------------+---------+-----------+----------+---------
 pid                | integer |           |          | 
 datid              | oid     |           |          | 
 datname            | name    |           |          | 
 relid              | oid     |           |          | 
 phase              | text    |           |          | 
 heap_blks_total    | bigint  |           |          | 
 heap_blks_scanned  | bigint  |           |          | 
 heap_blks_vacuumed | bigint  |           |          | 
 index_vacuum_count | bigint  |           |          | 
 max_dead_tuples    | bigint  |           |          | 
 num_dead_tuples    | bigint  |           |          |
    

文档: pg_stat_progress_vacuum

pg_stat_progress_vacuum (PostgreSQL 10)

           View "pg_catalog.pg_stat_progress_vacuum"
       Column       |  Type   | Collation | Nullable | Default 
--------------------+---------+-----------+----------+---------
 pid                | integer |           |          | 
 datid              | oid     |           |          | 
 datname            | name    |           |          | 
 relid              | oid     |           |          | 
 phase              | text    |           |          | 
 heap_blks_total    | bigint  |           |          | 
 heap_blks_scanned  | bigint  |           |          | 
 heap_blks_vacuumed | bigint  |           |          | 
 index_vacuum_count | bigint  |           |          | 
 max_dead_tuples    | bigint  |           |          | 
 num_dead_tuples    | bigint  |           |          |
    

文档: pg_stat_progress_vacuum

pg_stat_progress_vacuum (PostgreSQL 9.6)

View "pg_catalog.pg_stat_progress_vacuum"
       Column       |  Type   | Modifiers 
--------------------+---------+-----------
 pid                | integer | 
 datid              | oid     | 
 datname            | name    | 
 relid              | oid     | 
 phase              | text    | 
 heap_blks_total    | bigint  | 
 heap_blks_scanned  | bigint  | 
 heap_blks_vacuumed | bigint  | 
 index_vacuum_count | bigint  | 
 max_dead_tuples    | bigint  | 
 num_dead_tuples    | bigint  |
    

文档: pg_stat_progress_vacuum

变更历史

示例

示例pg_stat_progress_vacuum输出

postgres=# SELECT * FROM pg_stat_progress_vacuum;
-[ RECORD 1 ]------+--------------
pid                | 5270
datid              | 16389
datname            | appdb
relid              | 16861
phase              | scanning heap
heap_blks_total    | 162719
heap_blks_scanned  | 100350
heap_blks_vacuumed | 0
index_vacuum_count | 0
max_dead_tuples    | 11184810
num_dead_tuples    | 0

分类

监控进度报告视图清理

另请参阅

VACUUM进度报告pg_stat_progress_analyzepg_stat_progress_cluster

反馈

提交任何有关"pg_stat_progress_vacuum"的评论、建议或更正 此处