Re: ALTER TABLE SET STATISTICS requires AccessExclusiveLock

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TABLE SET STATISTICS requires AccessExclusiveLock
Date: 2010-07-18 17:20:25
Message-ID: 12734.1279473625@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On Sunday 18 July 2010 18:02:26 Simon Riggs wrote:
>> Then I think the fix is to look at the xmin values on all of the tables
>> used during planning and ensure that we only use constraint-based
>> optimisations in a serializable transaction when our top xmin is later
>> than the last DDL change (via its xmin).

> Why not just use a the normal snapshot at that point?

There isn't a "normal snapshot" that the planner should be relying on.
It doesn't know what snap the resulting plan will be used with.

I'm unconvinced that this is a problem worth worrying about, but if it
is then Simon's probably got the right idea: check the xmin of a
pg_constraint row before depending on it for planning. Compare the
handling of indexes made with CREATE INDEX CONCURRENTLY.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2010-07-18 17:23:44 Re: Review: Row-level Locks & SERIALIZABLE transactions, postgres vs. Oracle
Previous Message Kevin Grittner 2010-07-18 17:18:06 Re: Review: Row-level Locks & SERIALIZABLE transactions, postgres vs. Oracle