Updated on 2025-05-29 GMT+08:00

VACUUM System Functions

GS_STAT_PROGRESS_VACUUM(pid integer)

Description: Queries the VACUUM execution progress based on the PID of the VACUUM thread. AUTOVACUUM and manual VACUUM are supported.

Parameters: See "GS_STAT_PROGRESS_VACUUM input parameters and return values."

Table 1 GS_STAT_PROGRESS_VACUUM input parameters and return values

Parameter

Type

Description

pid

IN bigint

PID of the VACUUM thread.

dataname

OUT text

Name of the database that is being vacuumed.

relid

OUT oid

OID of the table that is being vacuumed.

relname

OUT text

Name of the table that is being vacuumed.

phase

OUT text

Current VACUUM phase.

detail

OUT text

Vacuum progress details, including the total number of pages, number of scanned pages, number of vacuumed pages, and number of vacuumed indexes.

Return type: record

Example:

gaussdb=# select * from GS_STAT_PROGRESS_VACUUM(139988726445824);
       pid       | dataname | relid | relname |     phase     |
           detail
-----------------+----------+-------+---------+---------------+---------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
 139988726445824 | postgres | 98304 | t1      | scanning heap | vacuum command "vacuum freeze t1;" starts at 2025-02-07 13:48:51.189748-05, vacuumed 5/12 partitio
ns, current part "a_lt_6"; heap: scanned 348/883 blocks, skipped 0 blocks; info: found 0 dead tuples, already run 0s, delay 0s.
(1 row)