{"Entry":{"collection":"catalog","key":"pg_stat_database","name":"pg_stat_database","aliases":[],"metadata":{"changed_in":["9.1","9.2","12","14","18"],"changes":[{"added":[],"attributes":[],"description_changed":true,"descriptions":[],"from":"8.0","order":false,"removed":[],"status":"reworded","to":"8.1","types":[]},{"added":[],"attributes":[],"description_changed":true,"descriptions":[],"from":"8.2","order":false,"removed":[],"status":"reworded","to":"8.3","types":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[],"from":"8.4","order":false,"removed":[],"status":"coverage","to":"9.0","types":[]},{"added":["conflicts","stats_reset"],"attributes":[],"description_changed":true,"descriptions":[],"from":"9.0","listing":[],"order":false,"removed":[],"status":"changed","to":"9.1","types":[],"unlisted":[]},{"added":["temp_files","temp_bytes","deadlocks","blk_read_time","blk_write_time"],"attributes":[],"description_changed":true,"descriptions":[],"from":"9.1","listing":[],"order":false,"removed":[],"status":"changed","to":"9.2","types":[],"unlisted":[]},{"added":["checksum_failures","checksum_last_failure"],"attributes":[],"description_changed":false,"descriptions":[{"from":"OID of a database","name":"datid","to":"OID of this database, or 0 for objects belonging to a shared relation"},{"from":"Name of this database","name":"datname","to":"Name of this database, or NULL for the shared objects."},{"from":"Number of backends currently connected to this database. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset.","name":"numbackends","to":"Number of backends currently connected to this database, or NULL for the shared objects. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset."}],"from":"11","listing":[],"order":false,"removed":[],"status":"changed","to":"12","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":true,"descriptions":[{"from":"Time spent reading data file blocks by backends in this database, in milliseconds","name":"blk_read_time","to":"Time spent reading data file blocks by backends in this database, in milliseconds (if track_io_timing is enabled, otherwise zero)"},{"from":"Time spent writing data file blocks by backends in this database, in milliseconds","name":"blk_write_time","to":"Time spent writing data file blocks by backends in this database, in milliseconds (if track_io_timing is enabled, otherwise zero)"},{"from":"Name of this database, or NULL for the shared objects.","name":"datname","to":"Name of this database, or NULL for shared objects."},{"from":"Number of backends currently connected to this database, or NULL for the shared objects. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset.","name":"numbackends","to":"Number of backends currently connected to this database, or NULL for shared objects. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset."}],"from":"12","listing":[],"order":false,"removed":[],"status":"reworded","to":"13","types":[],"unlisted":[]},{"added":["session_time","active_time","idle_in_transaction_time","sessions","sessions_abandoned","sessions_fatal","sessions_killed"],"attributes":[],"description_changed":false,"descriptions":[],"from":"13","listing":[],"order":false,"removed":[],"status":"changed","to":"14","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[{"from":"Number of rows fetched by queries in this database","name":"tup_fetched","to":"Number of live rows fetched by index scans in this database"},{"from":"Number of rows returned by queries in this database","name":"tup_returned","to":"Number of live rows fetched by sequential scans and index entries returned by index scans in this database"}],"from":"14","listing":[],"order":false,"removed":[],"status":"reworded","to":"15","types":[],"unlisted":[]},{"added":["parallel_workers_to_launch","parallel_workers_launched"],"attributes":[],"description_changed":false,"descriptions":[{"from":"Number of data page checksum failures detected in this database (or on a shared object), or NULL if data checksums are not enabled.","name":"checksum_failures","to":"Number of data page checksum failures detected in this database (or on a shared object), or NULL if data checksums are disabled."},{"from":"Time at which the last data page checksum failure was detected in this database (or on a shared object), or NULL if data checksums are not enabled.","name":"checksum_last_failure","to":"Time at which the last data page checksum failure was detected in this database (or on a shared object), or NULL if data checksums are disabled."}],"from":"17","listing":[],"order":false,"removed":[],"status":"changed","to":"18","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[{"from":"Number of data page checksum failures detected in this database (or on a shared object), or NULL if data checksums are disabled.","name":"checksum_failures","to":"Number of data page checksum failures detected in this database (or on a shared object). Detected failures are not reset if the data_checksums setting changes. Clusters which are initialized without data checksums will show this as 0. In PostgreSQL version 18 and earlier, this was set to NULL for clusters with data checksums disabled."},{"from":"Time at which the last data page checksum failure was detected in this database (or on a shared object), or NULL if data checksums are disabled.","name":"checksum_last_failure","to":"Time at which the last data page checksum failure was detected in this database (or on a shared object). Last failure is reported regardless of the data_checksums setting."}],"from":"19","listing":[],"order":false,"removed":[],"status":"reworded","to":"20","types":[],"unlisted":[]}],"column_count":30,"content_hash":"524947031dc0bd2650fcdebb96aeab042911fb250f874e3159fd3e14e7bc930f","first_version":"7.4","imported_at":"2026-09-30T00:40:55.900462+08:00","kind":"statistics","last_version":"20","name":"pg_stat_database","position":88,"present_in":["7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"relation_oid":null,"relkind":"v","shared":false,"source_rev":"english-manuals:26aba241e3f1da0ed58b9eb4534f571360144c98e0cb60a31b6d0ee85f8c33ea","summary":"The pg_stat_database view will contain one row for each database in the cluster, plus one for shared objects, showing database-wide statistics.","summary_zh":""}},"Definition":{"Collection":"catalog","Key":"pg_stat_database","SourceDatabase":"center","Version":"18","SourceTable":"catalog","SourceKey":"pg_stat_database","SourceRevision":"english-manuals:26aba241e3f1da0ed58b9eb4534f571360144c98e0cb60a31b6d0ee85f8c33ea","Facts":{"columns":[{"array_dimensions":0,"attnum":1,"description":"OID of this database, or 0 for objects belonging to a shared relation","description_zh":"","documented":true,"documented_name":"datid","hidden":false,"name":"datid","not_null":false,"references":"","type":"oid","type_modifier":-1,"type_oid":26},{"array_dimensions":0,"attnum":2,"description":"Name of this database, or NULL for shared objects.","description_zh":"","documented":true,"documented_name":"datname","hidden":false,"name":"datname","not_null":false,"references":"","type":"name","type_modifier":-1,"type_oid":19},{"array_dimensions":0,"attnum":3,"description":"Number of backends currently connected to this database, or NULL for shared objects. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset.","description_zh":"","documented":true,"documented_name":"numbackends","hidden":false,"name":"numbackends","not_null":false,"references":"","type":"integer","type_modifier":-1,"type_oid":23},{"array_dimensions":0,"attnum":4,"description":"Number of transactions in this database that have been committed","description_zh":"","documented":true,"documented_name":"xact_commit","hidden":false,"name":"xact_commit","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":5,"description":"Number of transactions in this database that have been rolled back","description_zh":"","documented":true,"documented_name":"xact_rollback","hidden":false,"name":"xact_rollback","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":6,"description":"Number of disk blocks read in this database","description_zh":"","documented":true,"documented_name":"blks_read","hidden":false,"name":"blks_read","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":7,"description":"Number of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the PostgreSQL buffer cache, not the operating system's file system cache)","description_zh":"","documented":true,"documented_name":"blks_hit","hidden":false,"name":"blks_hit","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":8,"description":"Number of live rows fetched by sequential scans and index entries returned by index scans in this database","description_zh":"","documented":true,"documented_name":"tup_returned","hidden":false,"name":"tup_returned","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":9,"description":"Number of live rows fetched by index scans in this database","description_zh":"","documented":true,"documented_name":"tup_fetched","hidden":false,"name":"tup_fetched","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":10,"description":"Number of rows inserted by queries in this database","description_zh":"","documented":true,"documented_name":"tup_inserted","hidden":false,"name":"tup_inserted","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":11,"description":"Number of rows updated by queries in this database","description_zh":"","documented":true,"documented_name":"tup_updated","hidden":false,"name":"tup_updated","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":12,"description":"Number of rows deleted by queries in this database","description_zh":"","documented":true,"documented_name":"tup_deleted","hidden":false,"name":"tup_deleted","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":13,"description":"Number of queries canceled due to conflicts with recovery in this database. (Conflicts occur only on standby servers; see pg_stat_database_conflicts for details.)","description_zh":"","documented":true,"documented_name":"conflicts","hidden":false,"name":"conflicts","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":14,"description":"Number of temporary files created by queries in this database. All temporary files are counted, regardless of why the temporary file was created (e.g., sorting or hashing), and regardless of the log_temp_files setting.","description_zh":"","documented":true,"documented_name":"temp_files","hidden":false,"name":"temp_files","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":15,"description":"Total amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting.","description_zh":"","documented":true,"documented_name":"temp_bytes","hidden":false,"name":"temp_bytes","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":16,"description":"Number of deadlocks detected in this database","description_zh":"","documented":true,"documented_name":"deadlocks","hidden":false,"name":"deadlocks","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":17,"description":"Number of data page checksum failures detected in this database (or on a shared object), or NULL if data checksums are disabled.","description_zh":"","documented":true,"documented_name":"checksum_failures","hidden":false,"name":"checksum_failures","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":18,"description":"Time at which the last data page checksum failure was detected in this database (or on a shared object), or NULL if data checksums are disabled.","description_zh":"","documented":true,"documented_name":"checksum_last_failure","hidden":false,"name":"checksum_last_failure","not_null":false,"references":"","type":"timestamp with time zone","type_modifier":-1,"type_oid":1184},{"array_dimensions":0,"attnum":19,"description":"Time spent reading data file blocks by backends in this database, in milliseconds (if track_io_timing is enabled, otherwise zero)","description_zh":"","documented":true,"documented_name":"blk_read_time","hidden":false,"name":"blk_read_time","not_null":false,"references":"","type":"double precision","type_modifier":-1,"type_oid":701},{"array_dimensions":0,"attnum":20,"description":"Time spent writing data file blocks by backends in this database, in milliseconds (if track_io_timing is enabled, otherwise zero)","description_zh":"","documented":true,"documented_name":"blk_write_time","hidden":false,"name":"blk_write_time","not_null":false,"references":"","type":"double precision","type_modifier":-1,"type_oid":701},{"array_dimensions":0,"attnum":21,"description":"Time spent by database sessions in this database, in milliseconds (note that statistics are only updated when the state of a session changes, so if sessions have been idle for a long time, this idle time won't be included)","description_zh":"","documented":true,"documented_name":"session_time","hidden":false,"name":"session_time","not_null":false,"references":"","type":"double precision","type_modifier":-1,"type_oid":701},{"array_dimensions":0,"attnum":22,"description":"Time spent executing SQL statements in this database, in milliseconds (this corresponds to the states active and fastpath function call in pg_stat_activity)","description_zh":"","documented":true,"documented_name":"active_time","hidden":false,"name":"active_time","not_null":false,"references":"","type":"double precision","type_modifier":-1,"type_oid":701},{"array_dimensions":0,"attnum":23,"description":"Time spent idling while in a transaction in this database, in milliseconds (this corresponds to the states idle in transaction and idle in transaction (aborted) in pg_stat_activity)","description_zh":"","documented":true,"documented_name":"idle_in_transaction_time","hidden":false,"name":"idle_in_transaction_time","not_null":false,"references":"","type":"double precision","type_modifier":-1,"type_oid":701},{"array_dimensions":0,"attnum":24,"description":"Total number of sessions established to this database","description_zh":"","documented":true,"documented_name":"sessions","hidden":false,"name":"sessions","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":25,"description":"Number of database sessions to this database that were terminated because connection to the client was lost","description_zh":"","documented":true,"documented_name":"sessions_abandoned","hidden":false,"name":"sessions_abandoned","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":26,"description":"Number of database sessions to this database that were terminated by fatal errors","description_zh":"","documented":true,"documented_name":"sessions_fatal","hidden":false,"name":"sessions_fatal","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":27,"description":"Number of database sessions to this database that were terminated by operator intervention","description_zh":"","documented":true,"documented_name":"sessions_killed","hidden":false,"name":"sessions_killed","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":28,"description":"Number of parallel workers planned to be launched by queries on this database","description_zh":"","documented":true,"documented_name":"parallel_workers_to_launch","hidden":false,"name":"parallel_workers_to_launch","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":29,"description":"Number of parallel workers launched by queries on this database","description_zh":"","documented":true,"documented_name":"parallel_workers_launched","hidden":false,"name":"parallel_workers_launched","not_null":false,"references":"","type":"bigint","type_modifier":-1,"type_oid":20},{"array_dimensions":0,"attnum":30,"description":"Time at which these statistics were last reset","description_zh":"","documented":true,"documented_name":"stats_reset","hidden":false,"name":"stats_reset","not_null":false,"references":"","type":"timestamp with time zone","type_modifier":-1,"type_oid":1184}],"description":"The pg_stat_database view will contain one row for each database in the cluster, plus one for shared objects, showing database-wide statistics.","description_zh":"","doc":{"anchor":"PG-STAT-DATABASE-VIEW","file":"monitoring-stats.html","lang":"en","sha256":"aa979eed08627fbf715a9d792094a162a73671db5af810f3ab2aad3e073d5722","slug":"18"},"kind":"statistics","lang":"en","measured_attributes":true,"metadata_release":"18.6","runtime_columns":["datid","datname","numbackends","xact_commit","xact_rollback","blks_read","blks_hit","tup_returned","tup_fetched","tup_inserted","tup_updated","tup_deleted","conflicts","temp_files","temp_bytes","deadlocks","checksum_failures","checksum_last_failure","blk_read_time","blk_write_time","session_time","active_time","idle_in_transaction_time","sessions","sessions_abandoned","sessions_fatal","sessions_killed","parallel_workers_to_launch","parallel_workers_launched","stats_reset"],"runtime_verified":false,"source":"english-manual"},"ManualEvidence":{"doc":{"anchor":"PG-STAT-DATABASE-VIEW","file":"monitoring-stats.html","lang":"en","sha256":"aa979eed08627fbf715a9d792094a162a73671db5af810f3ab2aad3e073d5722","slug":"18"}},"MeasuredEvidence":{"measured_attributes":true,"metadata_release":"18.6","runtime_columns":["datid","datname","numbackends","xact_commit","xact_rollback","blks_read","blks_hit","tup_returned","tup_fetched","tup_inserted","tup_updated","tup_deleted","conflicts","temp_files","temp_bytes","deadlocks","checksum_failures","checksum_last_failure","blk_read_time","blk_write_time","session_time","active_time","idle_in_transaction_time","sessions","sessions_abandoned","sessions_fatal","sessions_killed","parallel_workers_to_launch","parallel_workers_launched","stats_reset"],"runtime_verified":false}},"Text":{"Collection":"catalog","Key":"pg_stat_database","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"pg_stat_database","Summary":"pg_stat_database视图将包含一行用于集簇中的每个数据库，加一行用于共享对象，显示数据库范围的统计信息。","BodyHTML":"\u003cp\u003epg_stat_database视图将包含一行用于集簇中的每个数据库，加一行用于共享对象，显示数据库范围的统计信息。\u003c/p\u003e","SourceRevision":"2026-09-27@419045e","ContentHash":"a44f7114c6c749b21775a7393fb47c186f1051d11f17f3affdce053e0875c3e8","Payload":{"columns":[{"description_zh":"该数据库的OID，属于共享关系的对象为0","name":"datid","type":"oid","zh_from":"doc"},{"description_zh":"这个数据库的名称，或者共享对象为NULL。","name":"datname","type":"name","zh_from":"doc"},{"description_zh":"当前连接到此数据库的后端数，对于共享对象则为NULL。这是该视图中唯一返回反映当前状态的值的列；所有其他列返回自上次重置以来累积的值。","name":"numbackends","type":"integer","zh_from":"doc"},{"description_zh":"此数据库中已提交的事务数","name":"xact_commit","type":"bigint","zh_from":"doc"},{"description_zh":"该数据库中已回滚的事务数","name":"xact_rollback","type":"bigint","zh_from":"doc"},{"description_zh":"在该数据库中读取的磁盘块数","name":"blks_read","type":"bigint","zh_from":"doc"},{"description_zh":"在缓冲区缓存中发现磁盘块、因而无需读取的次数（这里只统计 PostgreSQL 缓冲区缓存中的命中，不包括操作系统文件系统缓存中的命中）","name":"blks_hit","type":"bigint","zh_from":"doc"},{"description_zh":"该数据库中由顺序扫描获取的活动行数和由索引扫描返回的索引条目数","name":"tup_returned","type":"bigint","zh_from":"doc"},{"description_zh":"该数据库中由索引扫描检索的活动行数","name":"tup_fetched","type":"bigint","zh_from":"doc"},{"description_zh":"查询在该数据库中插入的行数","name":"tup_inserted","type":"bigint","zh_from":"doc"},{"description_zh":"这个数据库中查询更新的行数","name":"tup_updated","type":"bigint","zh_from":"doc"},{"description_zh":"这个数据库中被查询删除的行数","name":"tup_deleted","type":"bigint","zh_from":"doc"},{"description_zh":"由于与此数据库中的恢复冲突而被取消的查询数。（冲突只会发生在备库上；请参阅pg_stat_database_conflicts。）","name":"conflicts","type":"bigint","zh_from":"doc"},{"description_zh":"这个数据库中查询创建的临时文件的数量。所有临时文件都将被计数，而不顾及临时文件为什么被创建（例如，排序或 hash 运算），也不考虑log_temp_files设置。","name":"temp_files","type":"bigint","zh_from":"doc"},{"description_zh":"这个数据库中的查询写入临时文件的数据总量。所有临时文件都将被计数，而不考虑临时文件为什么被创建，也不考虑log_temp_files设置。","name":"temp_bytes","type":"bigint","zh_from":"doc"},{"description_zh":"在此数据库中检测到的死锁数","name":"deadlocks","type":"bigint","zh_from":"doc"},{"description_zh":"在此数据库（或共享对象）中检测到的数据页校验和失败次数，如果未启用数据校验和则为 NULL。","name":"checksum_failures","type":"bigint","zh_from":"doc"},{"description_zh":"在此数据库（或共享对象）中最后一次检测到数据页校验和失败的时间，如果未启用数据校验和则为 NULL。","name":"checksum_last_failure","type":"timestamp with time zone","zh_from":"doc"},{"description_zh":"在这个数据库中通过后端读取数据文件块所花费的时间，以毫秒为单位（如果启用了track_io_timing，否则为零）","name":"blk_read_time","type":"double precision","zh_from":"doc"},{"description_zh":"在这个数据库中通过后端写数据文件块所花费的时间，以毫秒为单位（如果启用了track_io_timing，否则为零）","name":"blk_write_time","type":"double precision","zh_from":"doc"},{"description_zh":"此数据库中数据库会话所消耗的时间，以毫秒计（注意统计信息仅在会话状态发生变化时更新，因此如果会话空闲很长时间，则不包括此空闲时间）","name":"session_time","type":"double precision","zh_from":"doc"},{"description_zh":"此数据库中执行SQL语句所消耗的时间，以毫秒计（这对应于 pg_stat_activity中的 active 和 fastpath function call 状态）","name":"active_time","type":"double precision","zh_from":"doc"},{"description_zh":"此数据库中事务空闲所消耗的时间，以毫秒计（这对应于 pg_stat_activity中的 idle in transaction 和 idle in transaction (aborted) 状态）","name":"idle_in_transaction_time","type":"double precision","zh_from":"doc"},{"description_zh":"此数据库建立的会话总数","name":"sessions","type":"bigint","zh_from":"doc"},{"description_zh":"此数据库因为到客户端的连接丢失而被终止的数据库会话数","name":"sessions_abandoned","type":"bigint","zh_from":"doc"},{"description_zh":"此数据库因为致命错误而被终止的数据库会话数","name":"sessions_fatal","type":"bigint","zh_from":"doc"},{"description_zh":"此数据库因为操作者介入而被终止的数据库会话数","name":"sessions_killed","type":"bigint","zh_from":"doc"},{"description_zh":"计划由该数据库上的查询启动的并行工作进程数","name":"parallel_workers_to_launch","type":"bigint","zh_from":"doc"},{"description_zh":"由该数据库上的查询启动的并行工作进程数","name":"parallel_workers_launched","type":"bigint","zh_from":"doc"},{"description_zh":"这些统计信息上次被重置的时间","name":"stats_reset","type":"timestamp with time zone","zh_from":"doc"}],"description_zh":"pg_stat_database视图将包含一行用于集簇中的每个数据库，加一行用于共享对象，显示数据库范围的统计信息。","zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
