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

PG_AUTOVAC_STATUS

You can use this function to check whether a table reaches the AUTOVACUUM threshold. Pay attention to the values of doanalyze and dovacuum in the returned result. The columns in the view are defined as follows:

Table 1 PG_AUTOVAC_STATUS columns

Name

Type

Description

nspname

text

Name of a namespace.

relname

text

Name of an object, such as a table, an index, or a view.

nodename

text

Node name.

doanalyze

Boolean

Specifies whether to execute ANALYZE.

anltuples

bigint

Number of ANALYZE tuples.

anlthresh

bigint

ANALYZE threshold.

dovacuum

Boolean

Specifies whether to execute VACUUM.

vactuples

bigint

Number of VACUUM tuples.

vacthresh

bigint

VACUUM threshold.

The command output is as follows:

gaussdb=# select * from pg_autovac_status('t2'::regclass);
 nspname | relname | nodename | doanalyze | anltuples | anlthresh | dovacuum | vactuples | vacthresh
---------+---------+----------+-----------+-----------+-----------+----------+-----------+-----------
 public  | t2      | sgnode   | f         |         0 |      2050 | t        |     15002 |      4050
(1 row)