From: Tom Lane <tgl@sss.pgh.pa.us>
To: Luca Ferrari <fluca1978@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: ANALYZE, pg_class.xmin && pg_class.reltuples
Date: Thu, 25 Nov 2021 11:07:53 -0500
Message-ID: <297264.1637856473@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKoxK+7Uru98iwW=AZ=+qDJa5yzP3_mA5JS5CQX35LwAoaxw1g@mail.gmail.com>
References: <CAKoxK+7Uru98iwW=AZ=+qDJa5yzP3_mA5JS5CQX35LwAoaxw1g@mail.gmail.com>
Luca Ferrari <fluca1978@gmail.com> writes:
> I've a doubt about running ANALYZE and inspecting pg_class.xmin and
> pg_class.reltuples.
> ...
> So the pg_class record has changed its content, and in fact we are now
> 2 transaction away the table creation, but the pg_class.xmin is the
> same.
ANALYZE (and VACUUM) update the table's pg_class row non-transactionally.
See the comments for vac_update_relstats():
https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/commands/vacuum.c;h=5c4bc15...
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, fluca1978@gmail.com
Subject: Re: ANALYZE, pg_class.xmin && pg_class.reltuples
In-Reply-To: <297264.1637856473@sss.pgh.pa.us>
References: <CAKoxK+7Uru98iwW=AZ=+qDJa5yzP3_mA5JS5CQX35LwAoaxw1g@mail.gmail.com> <297264.1637856473@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox