| From: | "Pavlo Golub" <pavlo(dot)golub(at)cybertec(dot)at> |
|---|---|
| To: | "shihao zhong" <zhong950419(at)gmail(dot)com> |
| Cc: | "Robert Haas" <robertmhaas(at)gmail(dot)com>, assam258(at)gmail(dot)com, "Michael Paquier" <michael(at)paquier(dot)xyz>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re[2]: [PATCH v4] Add pg_current_vxact_id() function |
| Date: | 2026-08-31 10:47:13 |
| Message-ID: | emfa1b6f5d-f0d0-4f45-9c35-3a11b9fa7260@cybertec.at |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
>On a standby the function actually returns the VXID just fine -- the
>code only guards on MyProc/procNumber, which is the same condition %v
>uses, and StartTransaction assigns the vxid unconditionally during
>recovery (no RecoveryInProgress guard anywhere). We should change
>the commit message.
>
>Example:
>SELECT pg_is_in_recovery();
> pg_is_in_recovery
>-------------------
> t
>
>SELECT pg_current_vxact_id();
> pg_current_vxact_id
>---------------------
> 2/3
>
Thanks! Will check.
>
>
>On the use case: I first thought monitoring recovery conflicts might be a
>good example, but we can already do that with the PID. The cancelled query
>already logged PID plus timestamp.
>
>The only thing a VXID gives you over a PID is telling
>multiple transactions within the same backend/session, and I haven't
>been able to come up with a concrete case where you'd actually need that.
>
>Does anyone have one?
>
We do have in pg_timetable. The job is allowed to run in parallel, so at
the same time we can have 10 workers doing exactly the same. Also we do
log all the workflows, so to distinguish those workers we use VXIDs.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ewan Young | 2026-08-31 10:54:52 | Re: pg_upgrade: Test --check with a running source server |
| Previous Message | Nazir Bilal Yavuz | 2026-08-31 10:43:22 | Re: [PATCH] Speed up pg_waldump TAP test and fix some GitHub CI Windows flakiness |