On Fri, 2007-03-09 at 11:29 +0000, Heikki Linnakangas wrote:
> Is there a particular reason why CLUSTER isn't MVCC-safe? It seems to me 
> that it would be trivial to fix, by using SnapshotAny instead of 
> SnapshotNow, and not overwriting the xmin/xmax with the xid of the 
> cluster command.

It's trivial to fix now in this way, but it would break HOT, since an
indexscan only returns one row per index entry.

> I feel that I must missing something, or someone would've already fixed 
> it a long time ago...
> Csaba, you mentioned recently 
> (http://archives.postgresql.org/pgsql-hackers/2007-03/msg00027.php) that 
> you're actually using the MVCC-violation to clean up tables during a 
> backup. Can you tell us a bit more about that? Would you be upset if we 
> shut that backdoor?

On that thread I suggested we add NOWAIT syntax to allow the existing
behaviour to continue, as Csaba requested. The default should be to wait
for other transactions to complete, like CREATE INDEX CONCURRENTLY, when
the command is run outside of a transaction block.

If you do this any other way, you'll need to fix it for HOT.

> In any case, the MVCC-violation needs to be documented. I'll send a doc 
> patch to pgsql-patches shortly.

  Simon Riggs             
  EnterpriseDB   http://www.enterprisedb.com

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to