Re: No Index-Only Scan on Partial Index

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: No Index-Only Scan on Partial Index
Date: 2013-10-02 12:07:13
Message-ID: CAHyXU0xJPwqtBsz1tPKkNuyWgKOq7EJhNUUtzX1U81B8e+oqdw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tuesday, October 1, 2013, David E. Wheeler <david(at)justatheory(dot)com> wrote:
> On Oct 1, 2013, at 3:56 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
>
>> I don't think it has anything to do with the conditional index -- it's
>> the functional based. For some reason postgres always wants to post
>> filter (note the filter step below):
>>
>> postgres=# create index on try(upper_inf(irange));
>> CREATE INDEX
>> Time: 12.001 ms
>> postgres=# explain select * from try where upper_inf(irange);
>> QUERY PLAN
>>
-------------------------------------------------------------------------------
>> Index Scan using try_upper_inf_idx on try (cost=0.00..9.25 rows=33
width=40)
>> Index Cond: (upper_inf(irange) = true)
>> Filter: upper_inf(irange)
>
> Hrm. I get a seq scan for that query:
>
> create index on try(upper_inf(irange));
> explain select * from try where upper_inf(irange);
> QUERY PLAN
> -----------------------------------------------------------
> Seq Scan on try (cost=0.00..1887.00 rows=33333 width=68)
> Filter: upper_inf(irange)
>
> True also if I just select the irange. Is the filter the issue, here?

Turn off seq scan...

merlin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2013-10-02 12:59:42 Re: relscan_details.h
Previous Message Peter Eisentraut 2013-10-02 12:02:30 Re: [PATCH] Add use of asprintf()