Re: No Index-Only Scan on Partial Index - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: No Index-Only Scan on Partial Index
Date
Msg-id 76BCA8DC-048A-4631-A004-CBB152EE7FA0@justatheory.com
Whole thread Raw
In response to Re: No Index-Only Scan on Partial Index  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: No Index-Only Scan on Partial Index  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-hackers
On Oct 1, 2013, at 3:56 PM, Merlin Moncure <mmoncure@gmail.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?

Best,

David




pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: No Index-Only Scan on Partial Index
Next
From: Bruce Momjian
Date:
Subject: Re: insert throw error when year field len > 4 for timestamptz datatype