↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / Statistics & Metrics / pg_stat_xact_all_tables

pg_stat_xact_all_tables.n_tup_ins

Source-defined field pg_stat_xact_all_tables.n_tup_ins. The same-version manual describes this view but does not enumerate this column; the exact SQL expression is retained below.

Reading PostgreSQL 18.6.

Description

Source-defined field pg_stat_xact_all_tables.n_tup_ins. The same-version manual describes this view but does not enumerate this column; the exact SQL expression is retained below.

View
pg_stat_xact_all_tables
Field
n_tup_ins
Field evidence
Source declaration; not individually enumerated by the manual
Expression declared in
pg_stat_xact_all_tables

Usage

SELECT n_tup_ins FROM pg_catalog.pg_stat_xact_all_tables;

View semantics

Similar to pg_stat_all_tables, but counts actions taken so far within the current transaction (which are not yet included in pg_stat_all_tables and related views). The columns for numbers of live and dead rows and vacuum and analyze actions are not present in this view.

Collection and transaction context

A transaction can also see its own statistics (not yet flushed out to the shared memory statistics) in the views pg_stat_xact_all_tables , pg_stat_xact_sys_tables , pg_stat_xact_user_tables , and pg_stat_xact_user_functions . These numbers do not act as stated above; instead they update continuously throughout the transaction.

Exact source expression

No per-field definition, effective SQL type, unit, or reset rule is inferred from this expression.

pg_stat_get_xact_tuples_inserted(C.oid)

Complete source view definition

CREATE VIEW pg_stat_xact_all_tables AS
SELECT
            C.oid AS relid,
            N.nspname AS schemaname,
            C.relname AS relname,
            pg_stat_get_xact_numscans(C.oid) AS seq_scan,
            pg_stat_get_xact_tuples_returned(C.oid) AS seq_tup_read,
            sum(pg_stat_get_xact_numscans(I.indexrelid))::bigint AS idx_scan,
            sum(pg_stat_get_xact_tuples_fetched(I.indexrelid))::bigint +
            pg_stat_get_xact_tuples_fetched(C.oid) AS idx_tup_fetch,
            pg_stat_get_xact_tuples_inserted(C.oid) AS n_tup_ins,
            pg_stat_get_xact_tuples_updated(C.oid) AS n_tup_upd,
            pg_stat_get_xact_tuples_deleted(C.oid) AS n_tup_del,
            pg_stat_get_xact_tuples_hot_updated(C.oid) AS n_tup_hot_upd,
            pg_stat_get_xact_tuples_newpage_updated(C.oid) AS n_tup_newpage_upd
    FROM pg_class C LEFT JOIN
         pg_index I ON C.oid = I.indrelid
         LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
    WHERE C.relkind IN ('r', 't', 'm', 'p')
    GROUP BY C.oid, N.nspname, C.relname;

Related entries

Documentation and source

Source build
Version
18.6
Build
https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
Source fingerprint
555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

Compare versions

PostgreSQL 15 → 16: changed.

--- PostgreSQL 15
+++ PostgreSQL 16
@@ -3,5 +3,5 @@
   "source_expression": "pg_stat_get_xact_tuples_inserted(C.oid)",
   "source_view": "pg_stat_xact_all_tables",
   "view": "pg_stat_xact_all_tables",
-  "view_definition": "CREATE VIEW pg_stat_xact_all_tables AS\nSELECT\n            C.oid AS relid,\n            N.nspname AS schemaname,\n            C.relname AS relname,\n            pg_stat_get_xact_numscans(C.oid) AS seq_scan,\n            pg_stat_get_xact_tuples_returned(C.oid) AS seq_tup_read,\n            sum(pg_stat_get_xact_numscans(I.indexrelid))::bigint AS idx_scan,\n            sum(pg_stat_get_xact_tuples_fetched(I.indexrelid))::bigint +\n            pg_stat_get_xact_tuples_fetched(C.oid) AS idx_tup_fetch,\n            pg_stat_get_xact_tuples_inserted(C.oid) AS n_tup_ins,\n            pg_stat_get_xact_tuples_updated(C.oid) AS n_tup_upd,\n            pg_stat_get_xact_tuples_deleted(C.oid) AS n_tup_del,\n            pg_stat_get_xact_tuples_hot_updated(C.oid) AS n_tup_hot_upd\n    FROM pg_class C LEFT JOIN\n         pg_index I ON C.oid = I.indrelid\n         LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)\n    WHERE C.relkind IN ('r', 't', 'm', 'p')\n    GROUP BY C.oid, N.nspname, C.relname;"
+  "view_definition": "CREATE VIEW pg_stat_xact_all_tables AS\nSELECT\n            C.oid AS relid,\n            N.nspname AS schemaname,\n            C.relname AS relname,\n            pg_stat_get_xact_numscans(C.oid) AS seq_scan,\n            pg_stat_get_xact_tuples_returned(C.oid) AS seq_tup_read,\n            sum(pg_stat_get_xact_numscans(I.indexrelid))::bigint AS idx_scan,\n            sum(pg_stat_get_xact_tuples_fetched(I.indexrelid))::bigint +\n            pg_stat_get_xact_tuples_fetched(C.oid) AS idx_tup_fetch,\n            pg_stat_get_xact_tuples_inserted(C.oid) AS n_tup_ins,\n            pg_stat_get_xact_tuples_updated(C.oid) AS n_tup_upd,\n            pg_stat_get_xact_tuples_deleted(C.oid) AS n_tup_del,\n            pg_stat_get_xact_tuples_hot_updated(C.oid) AS n_tup_hot_upd,\n            pg_stat_get_xact_tuples_newpage_updated(C.oid) AS n_tup_newpage_upd\n    FROM pg_class C LEFT JOIN\n         pg_index I ON C.oid = I.indrelid\n         LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)\n    WHERE C.relkind IN ('r', 't', 'm', 'p')\n    GROUP BY C.oid, N.nspname, C.relname;"
 }

Compares recorded interfaces and attributes. Source fingerprints and build metadata are excluded; an absent sample is not proof of the introduction or removal release.

Related entries

Export JSON · Back to Statistics & Metrics · Recorded in PostgreSQL 10 through 20; the first sample is not necessarily its introduction.