Re: ALTER TABLE SET STATISTICS requires AccessExclusiveLock
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Simon Riggs <simon@2ndquadrant.com>, pgsql-hackers@postgresql.org
Date: 2010-07-18T17:20:25Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.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