Re: explain and index scan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: psql(at)elbrief(dot)de, pgsql-general(at)postgresql(dot)org
Subject: Re: explain and index scan
Date: 2012-02-27 16:26:25
Message-ID: 14493.1330359985@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at> writes:
> Andreas wrote:
>> Both select where shown as 'Index Scan'. But the second select is not
> a real index scan,

> A full scan of the index is also an index scan.

Yes. In particular it won't visit the heap for rows that don't satisfy
the index condition. So as long as the index is a good deal smaller
than the heap, this sort of plan is entirely sensible.

> I think that your example is pathological, and the only way I could
> reproduce it is by setting enable_seqscan=off.

I'm thinking he's got random_page_cost = 1.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message James B. Byrne 2012-02-27 16:51:11 Having a problem with RoR-3.1.1 and Pg-9.1
Previous Message Andrew Sullivan 2012-02-27 16:02:06 Re: Four issues why "old elephants" lack performance: Explanation sought Four issues why "old elephants" lack performance: Explanation sought