Re: CLUSTER and MVCC - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: CLUSTER and MVCC
Date
Msg-id 20070309154855.GB10875@alvh.no-ip.org
Whole thread Raw
In response to Re: CLUSTER and MVCC  ("Zeugswetter Andreas ADI SD" <ZeugswetterA@spardat.at>)
Responses Re: CLUSTER and MVCC  ("Simon Riggs" <simon@2ndquadrant.com>)
List pgsql-hackers
Zeugswetter Andreas ADI SD 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.
> 
> Well, with SnapshotAny HOT should probably return all possibly visible
> tuples
> with an indexscan. (Btw, does CLUSTER really do an index scan ? Seems
> for reading a whole table a seq scan and sort is usually cheaper, at
> least when the clustering is so bad that a CLUSTER is needed.)

Yes, it does an indexscan (last time I checked, at least).  I think if a
performance improvement is demonstrated, we would accept a patch ...

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: CLUSTER and MVCC
Next
From: Heikki Linnakangas
Date:
Subject: Re: CLUSTER and MVCC