Re: Will partial index creation use existing index?

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Ron Johnson" <ron(dot)l(dot)johnson(at)cox(dot)net>
Cc: "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Will partial index creation use existing index?
Date: 2007-07-25 08:01:26
Message-ID: 87tzrs6hex.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Ron Johnson" <ron(dot)l(dot)johnson(at)cox(dot)net> writes:

>> The main disadvantage is that it's not clear when it would actually be faster.
>> Generally index scans are slower than reading the whole table and sorting.
>> Probably it would have to run an SPI query to use the planner to find the best
>> way to get the rows it wants.
>
> I believe you, but it's totally counter to prima-fascia logic.
>
> Scanning the whole table means that you have to read in a whole
> bunch of columns that you don't really give a rat's arse about, and
> thus is a waste, whereas directly reading an existing index means
> that you've got perfect locality of data, since you're only reading
> what you care about.

Well you still have to read the table either way. The main difference is
you'll end up reading it in a random access order which is slower and also
means potentially reading parts of it many times over before you're done.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Stark 2007-07-25 08:09:05 Re: a few questions (and doubts) about xid
Previous Message Albe Laurenz 2007-07-25 07:13:28 Re: ssl connections to postgresql