Updated on 2024-06-03 GMT+08:00

STAT_DATABASE

Displays the statistics of the current node in the database, as described in Table 1.

Table 1 STAT_DATABASE columns

Name

Type

Description

datid

oid

OID of the database.

datname

name

Database name.

numbackends

integer

Number of backends currently connected to this database.

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 disk blocks that have been hit in the cache. In this case, data does not need to be read from disks. (The cache includes only the buffer cache and does not include the file system cache of the OS.)

tup_returned

bigint

Number of live rows fetched by sequential scans and number of index rows returned by index scans in the database.

tup_fetched

bigint

Number of rows returned by the current database through indexes.

tup_inserted

bigint

Number of rows inserted.

tup_updated

bigint

Number of rows updated.

tup_deleted

bigint

Number of rows deleted.

conflicts

bigint

Number of queries canceled due to conflicts with database replay (conflicts occur only on the standby node). For details, see STAT_DATABASE_CONFLICTS.

temp_files

bigint

Number of temporary files created by queries in this database. All temporary files are counted, which is not affected by the value of the GUC parameter log_temp_files.

temp_bytes

bigint

Total amount of data written to temporary files by queries in this database. All temporary files are counted, which is not affected by the value of the GUC parameter log_temp_files.

deadlocks

bigint

Number of deadlocks detected in this database.

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 in writing data file blocks by backends in this database (unit: ms).

stats_reset

timestamp with time zone

Time at which the current statistics were reset.