pg_stat_xact_sys_tables

一个统计视图,显示当前事务期间对每个系统表的访问统计信息

pg_stat_xact_sys_tables 是一个统计视图,显示当前事务期间对当前数据库中每个系统表的访问统计信息。

pg_stat_xact_sys_tablesPostgreSQL 9.1 中添加。

按PostgreSQL版本定义

pg_stat_xact_sys_tables (PostgreSQL 17)

          View "pg_catalog.pg_stat_xact_sys_tables"
      Column       |  Type  | Collation | Nullable | Default 
-------------------+--------+-----------+----------+---------
 relid             | oid    |           |          | 
 schemaname        | name   |           |          | 
 relname           | name   |           |          | 
 seq_scan          | bigint |           |          | 
 seq_tup_read      | bigint |           |          | 
 idx_scan          | bigint |           |          | 
 idx_tup_fetch     | bigint |           |          | 
 n_tup_ins         | bigint |           |          | 
 n_tup_upd         | bigint |           |          | 
 n_tup_del         | bigint |           |          | 
 n_tup_hot_upd     | bigint |           |          | 
 n_tup_newpage_upd | bigint |           |          |
    

文档: pg_stat_xact_sys_tables

pg_stat_xact_sys_tables (PostgreSQL 16)

          View "pg_catalog.pg_stat_xact_sys_tables"
      Column       |  Type  | Collation | Nullable | Default 
-------------------+--------+-----------+----------+---------
 relid             | oid    |           |          | 
 schemaname        | name   |           |          | 
 relname           | name   |           |          | 
 seq_scan          | bigint |           |          | 
 seq_tup_read      | bigint |           |          | 
 idx_scan          | bigint |           |          | 
 idx_tup_fetch     | bigint |           |          | 
 n_tup_ins         | bigint |           |          | 
 n_tup_upd         | bigint |           |          | 
 n_tup_del         | bigint |           |          | 
 n_tup_hot_upd     | bigint |           |          | 
 n_tup_newpage_upd | bigint |           |          |
    

文档: pg_stat_xact_sys_tables

pg_stat_xact_sys_tables (PostgreSQL 15)

        View "pg_catalog.pg_stat_xact_sys_tables"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 seq_scan      | bigint |           |          | 
 seq_tup_read  | bigint |           |          | 
 idx_scan      | bigint |           |          | 
 idx_tup_fetch | bigint |           |          | 
 n_tup_ins     | bigint |           |          | 
 n_tup_upd     | bigint |           |          | 
 n_tup_del     | bigint |           |          | 
 n_tup_hot_upd | bigint |           |          |
    

文档: pg_stat_xact_sys_tables

pg_stat_xact_sys_tables (PostgreSQL 14)

        View "pg_catalog.pg_stat_xact_sys_tables"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 seq_scan      | bigint |           |          | 
 seq_tup_read  | bigint |           |          | 
 idx_scan      | bigint |           |          | 
 idx_tup_fetch | bigint |           |          | 
 n_tup_ins     | bigint |           |          | 
 n_tup_upd     | bigint |           |          | 
 n_tup_del     | bigint |           |          | 
 n_tup_hot_upd | bigint |           |          |
    

文档: pg_stat_xact_sys_tables

pg_stat_xact_sys_tables (PostgreSQL 13)

        View "pg_catalog.pg_stat_xact_sys_tables"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 seq_scan      | bigint |           |          | 
 seq_tup_read  | bigint |           |          | 
 idx_scan      | bigint |           |          | 
 idx_tup_fetch | bigint |           |          | 
 n_tup_ins     | bigint |           |          | 
 n_tup_upd     | bigint |           |          | 
 n_tup_del     | bigint |           |          | 
 n_tup_hot_upd | bigint |           |          |
    

文档: pg_stat_xact_sys_tables

pg_stat_xact_sys_tables (PostgreSQL 12)

        View "pg_catalog.pg_stat_xact_sys_tables"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 seq_scan      | bigint |           |          | 
 seq_tup_read  | bigint |           |          | 
 idx_scan      | bigint |           |          | 
 idx_tup_fetch | bigint |           |          | 
 n_tup_ins     | bigint |           |          | 
 n_tup_upd     | bigint |           |          | 
 n_tup_del     | bigint |           |          | 
 n_tup_hot_upd | bigint |           |          |
    

文档: pg_stat_xact_sys_tables

pg_stat_xact_sys_tables (PostgreSQL 11)

        View "pg_catalog.pg_stat_xact_sys_tables"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 seq_scan      | bigint |           |          | 
 seq_tup_read  | bigint |           |          | 
 idx_scan      | bigint |           |          | 
 idx_tup_fetch | bigint |           |          | 
 n_tup_ins     | bigint |           |          | 
 n_tup_upd     | bigint |           |          | 
 n_tup_del     | bigint |           |          | 
 n_tup_hot_upd | bigint |           |          |
    

文档: pg_stat_xact_sys_tables

pg_stat_xact_sys_tables (PostgreSQL 10)

        View "pg_catalog.pg_stat_xact_sys_tables"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 seq_scan      | bigint |           |          | 
 seq_tup_read  | bigint |           |          | 
 idx_scan      | bigint |           |          | 
 idx_tup_fetch | bigint |           |          | 
 n_tup_ins     | bigint |           |          | 
 n_tup_upd     | bigint |           |          | 
 n_tup_del     | bigint |           |          | 
 n_tup_hot_upd | bigint |           |          |
    

文档: pg_stat_xact_sys_tables

pg_stat_xact_sys_tables (PostgreSQL 9.6)

View "pg_catalog.pg_stat_xact_sys_tables"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 seq_scan      | bigint | 
 seq_tup_read  | bigint | 
 idx_scan      | bigint | 
 idx_tup_fetch | bigint | 
 n_tup_ins     | bigint | 
 n_tup_upd     | bigint | 
 n_tup_del     | bigint | 
 n_tup_hot_upd | bigint |
    

文档: pg_stat_xact_sys_tables

pg_stat_xact_sys_tables (PostgreSQL 9.5)

View "pg_catalog.pg_stat_xact_sys_tables"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 seq_scan      | bigint | 
 seq_tup_read  | bigint | 
 idx_scan      | bigint | 
 idx_tup_fetch | bigint | 
 n_tup_ins     | bigint | 
 n_tup_upd     | bigint | 
 n_tup_del     | bigint | 
 n_tup_hot_upd | bigint |
    

文档: pg_stat_xact_sys_tables

pg_stat_xact_sys_tables (PostgreSQL 9.4)

View "pg_catalog.pg_stat_xact_sys_tables"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 seq_scan      | bigint | 
 seq_tup_read  | bigint | 
 idx_scan      | bigint | 
 idx_tup_fetch | bigint | 
 n_tup_ins     | bigint | 
 n_tup_upd     | bigint | 
 n_tup_del     | bigint | 
 n_tup_hot_upd | bigint |
    

文档: pg_stat_xact_sys_tables

pg_stat_xact_sys_tables (PostgreSQL 9.3)

View "pg_catalog.pg_stat_xact_sys_tables"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 seq_scan      | bigint | 
 seq_tup_read  | bigint | 
 idx_scan      | bigint | 
 idx_tup_fetch | bigint | 
 n_tup_ins     | bigint | 
 n_tup_upd     | bigint | 
 n_tup_del     | bigint | 
 n_tup_hot_upd | bigint |
    

文档: pg_stat_xact_sys_tables

pg_stat_xact_sys_tables (PostgreSQL 9.2)

View "pg_catalog.pg_stat_xact_sys_tables"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 seq_scan      | bigint | 
 seq_tup_read  | bigint | 
 idx_scan      | bigint | 
 idx_tup_fetch | bigint | 
 n_tup_ins     | bigint | 
 n_tup_upd     | bigint | 
 n_tup_del     | bigint | 
 n_tup_hot_upd | bigint |
    

文档: pg_stat_xact_sys_tables

pg_stat_xact_sys_tables (PostgreSQL 9.1)

View "pg_catalog.pg_stat_xact_sys_tables"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 seq_scan      | bigint | 
 seq_tup_read  | bigint | 
 idx_scan      | bigint | 
 idx_tup_fetch | bigint | 
 n_tup_ins     | bigint | 
 n_tup_upd     | bigint | 
 n_tup_del     | bigint | 
 n_tup_hot_upd | bigint |
    

文档: pg_stat_xact_sys_tables

更改历史记录

示例

使用 pg_stat_xact_sys_tables 显示在创建表的交易期间发生插入操作的所有系统表

postgres=*# CREATE TABLE foo (id INT, val TEXT);
CREATE TABLE

postgres=*# SELECT schemaname, relname, n_tup_ins
              FROM pg_stat_xact_sys_tables
             WHERE n_tup_ins > 0;
 schemaname |   relname    | n_tup_ins 
------------+--------------+-----------
 pg_catalog | pg_type      |         2
 pg_catalog | pg_depend    |         6
 pg_catalog | pg_index     |         1
 pg_catalog | pg_attribute |        19
 pg_catalog | pg_class     |         3
(5 rows)

postgres=*# commit;
COMMIT

postgres=# SELECT schemaname, relname, n_tup_ins
  FROM pg_stat_xact_sys_tables
 WHERE n_tup_ins > 0;
 schemaname | relname | n_tup_ins 
------------+---------+-----------
(0 rows)

分类

统计/监控视图

另请参阅

pg_stat_all_tablespg_stat_sys_tablespg_stat_user_tablespg_stat_xact_all_tablespg_stat_xact_user_tablespg_statio_all_tablespg_statio_sys_tablespg_statio_user_tables

反馈

提交任何关于 "pg_stat_xact_sys_tables" 的评论、建议或更正 在此