Re: Statistics visibility in SERIALIZABLE transactions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Statistics visibility in SERIALIZABLE transactions
Date: 2006-11-20 06:12:56
Message-ID: 23237.1164003176@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-11-20 06:15:42 Re: psql: present working directory
Previous Message Brendan Jurd 2006-11-20 06:09:57 psql: present working directory