Re: Cluster and MVCC

From: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
To: "Brad Nicholson" <bnichols(at)ca(dot)afilias(dot)info>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Cluster and MVCC
Date: 2007-08-10 17:34:03
Message-ID: 1186767243.5344.111.camel@ebony.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2007-08-10 at 10:02 -0400, Brad Nicholson wrote:
> I just want to confirm that the cluster/MVCC issues are due to
> transaction visibility. Assuming that no concurrent access is happening
> to a given table when the cluster command is issued (when takes it
> visibility snapshot), it is safe to cluster that table. Correct?

Yes, as long as pre-existing transactions do not then access the
clustered table. If they do, rows they should have seen will now not be
visible, yet you won't get an error message to say so.

You can check this by doing something similar to...

create temporary table xids as
select transactionid from pg_stat_activity a, pg_locks l where a.procpid
= l.pid and l.transactionid is not null;

cluster ....

select 'Possible MVCC violation if ' || transactionid || ' touches
clustered table' from pg_locks where transactionid in (select
transactionid from xids);
drop table xids;

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marc Rossi 2007-08-10 17:35:59 Re: UPDATES hang every 5 minutes
Previous Message Greg Smith 2007-08-10 17:31:58 Re: Configuration starting point...