| From: | Julien Rouhaud <rjuju123(at)gmail(dot)com> | 
|---|---|
| To: | reg_pg_stefanz(at)perfexpert(dot)ch | 
| Cc: | "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> | 
| Subject: | Re: increase of xact_commit vs txid_current | 
| Date: | 2020-05-07 18:22:00 | 
| Message-ID: | CAOBaU_ZWR_fp5Xr8K8HhAi654byOtBekpqaZ+mKhx8n2S=bXWA@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On Thu, May 7, 2020 at 7:01 PM <reg_pg_stefanz(at)perfexpert(dot)ch> wrote:
>
> Hi,
>
> I am confused, the documentation says for pg_stat_database
>     xact_commit      Number of transactions in this database that have
> been committed
> and somewhere else
>      txid_current()    get current transaction ID, assigning a new one
> if the current transaction does not have one
>
> I would have naively expected txid_current() be more or less in line
> with xact_commit,  or  increasing faster as txid_current() should be
> global but xact_commit is per database.
>
> However xact_commit seems to increases faster than txid_current(),  what
> am I missing? Are there commits that do not increase the xid number?
Indeed, read-only transactions usually don't consume a transaction id,
to avoid the need to perform a FREEZE too often.  Note that pcalling
txid_current() will consume such a transaction id, even in a read only
query.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | github kran | 2020-05-07 18:23:04 | AutoVacuum and growing transaction XID's | 
| Previous Message | Amarendra Konda | 2020-05-07 18:07:42 | Re: Explain plan changes - IN CLAUSE ( Passing direct values Vs INNER Query ) |