Re: Will partial index creation use existing index? - Mailing list pgsql-general

From Gregory Stark
Subject Re: Will partial index creation use existing index?
Date
Msg-id 87tzrs6hex.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Will partial index creation use existing index?  (Ron Johnson <ron.l.johnson@cox.net>)
List pgsql-general
"Ron Johnson" <ron.l.johnson@cox.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


pgsql-general by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: ssl connections to postgresql
Next
From: Gregory Stark
Date:
Subject: Re: a few questions (and doubts) about xid