Re: Statistics visibility in SERIALIZABLE transactions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Statistics visibility in SERIALIZABLE transactions
Date
Msg-id 23237.1164003176@sss.pgh.pa.us
Whole thread Raw
In response to Statistics visibility in SERIALIZABLE transactions  (Michael Fuhr <mike@fuhr.org>)
Responses Re: Statistics visibility in SERIALIZABLE transactions  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
Michael Fuhr <mike@fuhr.org> writes:
> Updates to planner statistics appear to be visible in SERIALIZABLE
> transactions even though updated data is not.  Is this intentional?

This is because the planner uses the catcache to read pg_statistic, and
that runs on SnapshotNow rules.  I am not excited about it: as a general
rule you want to be using the latest stats available.  It is much more
likely that the stats existing at the start of your transaction are
out-of-date than that they are a better representation of the data in
your snapshot than stats committed a bit later.  It's an approximation
either way...

(Actually, in general catalog changes apply immediately even in
SERIALIZABLE mode.  Try looking at a table that was ALTERed since
your transaction began.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Brendan Jurd"
Date:
Subject: psql: present working directory
Next
From: Tom Lane
Date:
Subject: Re: psql: present working directory