Re: question on scan of clustered index

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: pwing(at)student(dot)umass(dot)edu
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: question on scan of clustered index
Date: 2007-07-13 01:29:47
Message-ID: 20070713012947.GQ4887@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

* pwing(at)student(dot)umass(dot)edu (pwing(at)student(dot)umass(dot)edu) wrote:
> I am running three ways: sequential scan, bitmap index scan and index scan.
> The I/O cost for the index scan is 24+ times more than the other two. I do not
> understand why this happens. If I am using a clustered index, it is my
> understanding that there should be no need to retrieve a single page multiple
> times, as tuples are sorted. Am I misunderstanding something?

That does seem kind of bad (24+ times is quite a bit). At the same time
though, you are having to go through the index when you're doing an
index scan whereas you don't with the seq scan, so you're certainly
pulling in more data of the disk.

I'm a bit mystified why you'd think an index scan to pull half the data
from a table is going to be faster than a seq scan anyway though... If
you're trying to speed up the query to pull half the records you might
want to look into partitioned tables instead, though I doubt it'll get
much faster...

Thanks,

Stephen

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-07-13 01:39:07 Re: optimizing postgres
Previous Message Stephen Frost 2007-07-13 01:25:52 Re: optimizing postgres