Re: Equivalent praxis to CLUSTERED INDEX? - Mailing list pgsql-performance

From J. Andrew Rogers
Subject Re: Equivalent praxis to CLUSTERED INDEX?
Date
Msg-id 1093547088.349.134.camel@vulture.corp.neopolitan.com
Whole thread Raw
In response to Re: Equivalent praxis to CLUSTERED INDEX?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Equivalent praxis to CLUSTERED INDEX?  (Mischa Sandberg <ischamay.andbergsay@activestateway.com>)
Re: Equivalent praxis to CLUSTERED INDEX?  ("Jim C. Nasby" <decibel@decibel.org>)
List pgsql-performance
On Thu, 2004-08-26 at 11:18, Bruce Momjian wrote:
> How do vendors actually implement auto-clustering?  I assume they move
> rows around during quiet periods or have lots of empty space in each
> value bucket.


As far as I know, Oracle does it by having a B-Tree organized heap (a
feature introduced around v8 IIRC), basically making the primary key
index and the heap the same physical structure.  Any non-index columns
are stored in the index along with the index columns.  Implementing it
is slightly weird because searching the index and selecting the rows
from the heap are not separate operations.

The major caveat to having tables of this type is that you can only have
a primary key index.  No other indexes are possible because the "heap"
constantly undergoes local reorganizations if you have a lot of write
traffic, the same kind of reorganization you would normally expect in a
BTree index.

The performance improvements come from two optimizations.  First, you
have to touch significantly fewer blocks to get all the rows, even
compared to a CLUSTERed heap.  Second, the footprint is smaller and
plays nicely with the buffer cache.

When I've used these types of heaps in Oracle 8 on heavily used tables
with tens of millions of rows, we frequently got a 10x or better
performance improvement on queries against those tables.  It is only
really useful for tables with vast quantities of relatively small rows,
but it can be a lifesaver in those cases.


J. Andrew Rogers



pgsql-performance by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Equivalent praxis to CLUSTERED INDEX?
Next
From: Kevin Barnard
Date:
Subject: Re: Anyone familiar with Apple Xserve RAID