Michael Fuhr <mike(at)fuhr(dot)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