Re: CLUSTER and indisclustered

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: CLUSTER and indisclustered
Date: 2002-08-04 03:21:45
Message-ID: 200208040321.g743Ljo26619@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gavin Sherry wrote:
> > Gavin, is that a big win compared to just using the index and looping
> > through the entries, knowing that the index matches are on the same
> > page, and the heap matches are on the same page.
>
> Bruce,
>
> It would cut out the index over head. Besides at (1) (above) we would have
> determined that an index scan was too expensive and we would be using a
> SeqScan instead. This would just be faster, since a) we would locate the
> tuples more intelligently b) we wouldn't need to scan the whole heap once
> we'd found all tuples matching the scan key.

Yes, but in a clustered table, an index scan is _never_ (?) more
expensive than a sequential scan, at least if the optimizer is working
correctly. Index scans are slower only because they assume random heap
access, but with a clustered table, there is no random heap access. The
index takes to right to the spot to start.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-08-04 03:22:53 Re: CLUSTER and indisclustered
Previous Message Tom Lane 2002-08-04 03:20:17 Re: CLUSTER and indisclustered