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

PG_STAT_DATABASE

PG_STAT_DATABASE displays statistics for each database in GaussDB. In the multi-tenancy scenario, information about a PDB is returned to its own PDB.

Table 1 PG_STAT_DATABASE columns

Name

Type

Description

datid

oid

OID of a database.

datname

name

Database name.

numbackends

integer

Number of backends currently connected to this database. This is the only column in the view that returns the status value. Other columns return the accumulated value since the last reset.

xact_commit

bigint

Number of transactions in this database that have been committed.

xact_rollback

bigint

Number of transactions in this database that have been rolled back.

blks_read

bigint

Number of disk blocks read in this database.

blks_hit

bigint

Number of times that disk blocks have been found in the buffer cache and therefore the disk blocks do not need to be read (only those found in the buffer cache are counted, excluding those found in the file system cache of the OS).

tup_returned

bigint

Number of rows returned by queries in this database.

tup_fetched

bigint

Number of rows fetched by queries in this database.

tup_inserted

bigint

Number of rows inserted by queries in this database.

tup_updated

bigint

Number of rows updated by queries in this database.

tup_deleted

bigint

Number of rows deleted by queries in this database.

conflicts

bigint

Number of queries canceled due to database recovery conflicts (conflicts occurring only on the standby server). For details, see PG_STAT_DATABASE_CONFLICTS.

temp_files

bigint

Number of temporary files created by queries in this database. Calculates all temporary files, regardless of why the temporary files are created (such as sorting or hashing) or the setting of the log_temp_files parameter.

temp_bytes

bigint

Total amount of data written to temporary files by queries in this database. Calculates all temporary files, regardless of why the temporary files are created or the setting of the log_temp_files parameter.

deadlocks

bigint

Number of all deadlocks detected in the database since the last reset of statistics.

blk_read_time

double precision

Time spent reading data file blocks by backends in this database (unit: ms).

blk_write_time

double precision

Time spent writing into data file blocks by backends in this database (unit: ms).

stats_reset

timestamp with time zone

Time when the status statistics are reset.