Re: Trying to understand page structures in PG - Mailing list pgsql-general

From Rakesh Kumar
Subject Re: Trying to understand page structures in PG
Date
Msg-id CAJBB=EWXzfSDLaf=FBxipeob79rei_=9JGvPqmCRuAEe8gTiCw@mail.gmail.com
Whole thread Raw
In response to Re: Trying to understand page structures in PG  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Responses Re: Trying to understand page structures in PG
List pgsql-general
On Wed, Apr 6, 2016 at 6:33 AM, Albe Laurenz <laurenz.albe@wien.gv.at> wrote:
> Rakesh Kumar wrote:

> Every row has two system columns associated with it: xmin and xmax
>
> xmin is the transaction ID that created the row, while xmax is
> the transaction ID that removed the row.
>
> So when an update takes place, xmax of the original row and xmin
> of the new row are set to the transaction ID of the current transaction.
>
> Furthermore, the commit log (CLOG) logs for each transaction whether
> it was committed or rolled back.
>
> Now when a backend examines a row, it first checks if the row is
> visible, i.e. xmin must be less or equal to the current transaction ID
> and xmax must be 0 or greater than the current transaction ID
> or belong to a transaction that was rolled back.
>
> To save CLOG lookups, the first reader who consults the CLOG will
> save the result in so-called "hint bits" on the row itself.

I am assuming the same must be true for the indexes also. Does PG look
up primary key
by examining the rows like you described above.


pgsql-general by date:

Previous
From: Alex Ignatov
Date:
Subject: Non-default postgresql.conf values to log
Next
From: Lars Arvidson
Date:
Subject: Re: Problem after replication switchover