Re: Postgres-native method to identify if a tuple is frozen

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Lawrence Jones <lawrence(at)gocardless(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Postgres-native method to identify if a tuple is frozen
Date: 2020-07-21 12:22:05
Message-ID: CAA4eK1L1mNU5RkuDmEix=5hJRfaLsibeHdCR-YnjWixi_35cZw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 20, 2020 at 9:07 PM Lawrence Jones <lawrence(at)gocardless(dot)com> wrote:
>
>
> So we hit the question: how can we identify if a tuple is frozen? I know the tuple has both committed and aborted hint bits set, but accessing those bits seems to require superuser functions and are unlikely to be that fast.
>
> Are there system columns (similar to xmin, tid, cid) that we don't know about?
>

I think the way to get that information is to use pageinspect
extension and use some query like below but you are right that you
need superuser privilege for that:

SELECT t_ctid, raw_flags, combined_flags
FROM heap_page_items(get_raw_page('pg_class', 0)),
LATERAL heap_tuple_infomask_flags(t_infomask, t_infomask2)
WHERE t_infomask IS NOT NULL OR t_infomask2 IS NOT NULL;

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2020-07-21 13:21:17 Re: Allow ERROR from heap_prepare_freeze_tuple to be downgraded to WARNING
Previous Message Daniel Gustafsson 2020-07-21 12:13:32 OpenSSL randomness seeding