Re: What's the best practice to compare the transaction with the checkpoint?

From: Jialun Zhang <reatank(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Re: What's the best practice to compare the transaction with the checkpoint?
Date: 2020-07-06 14:09:35
Message-ID: CAMFL+JjnQE8NWP1vMxfzJXFyjCP-9yvA6ku6FkJAjTpRkOoyTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Thanks! But what I actually mean is how to do this in the backend source
code. I think I could find a way to do this SELECT in backend.

Thank you,
Jialun Zhang

Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> 于2020年7月6日周一 上午4:09写道:

> On Sat, 2020-07-04 at 12:19 -0400, Jialun Zhang wrote:
> > I am trying to add code to determine whether the transaction is
> checkpointed or not.
> > So I think I need to compare the transaction ID with the checkpoint's
> and determine
> > whether it is older or not. Could anyone tell me what's the best
> practice of doing
> > this in Postgres? Is it done somewhere in the existing code?
>
> You could use
>
> SELECT next_xid FROM pg_control_checkpoint();
>
> to get information about the last checkpoint.
>
> I refrain from asking what the point of the exercise is...
>
> Yours,
> Laurenz Albe
> --
> Cybertec | https://www.cybertec-postgresql.com
>
>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Gerald Cheves 2020-07-06 14:58:40 Re: What's the best practice to compare the transaction with the checkpoint?
Previous Message Laurenz Albe 2020-07-06 08:09:09 Re: What's the best practice to compare the transaction with the checkpoint?