Re: [HACKERS] No Index-Only Scan on Partial Index

2013-10-03 Thread David E. Wheeler
On Oct 3, 2013, at 10:50 AM, Josh Berkus wrote: >> >> But anyway, I still don’t understand why, if the function used to store the >> value is immutable (as upper_inf() is), why Postgres doesn't do an index >> scan. Is this something that could be improved in the planner? > > Yes. This is cle

Re: [HACKERS] No Index-Only Scan on Partial Index

2013-10-03 Thread Josh Berkus
David, > But anyway, I still don’t understand why, if the function used to store the > value is immutable (as upper_inf() is), why Postgres doesn't do an index > scan. Is this something that could be improved in the planner? Yes. This is clearly a TODO. -- Josh Berkus PostgreSQL Experts Inc.

Re: [HACKERS] No Index-Only Scan on Partial Index

2013-10-03 Thread David E. Wheeler
On Oct 2, 2013, at 5:07 AM, Merlin Moncure wrote: > > 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 > > ---

Re: [HACKERS] No Index-Only Scan on Partial Index

2013-10-02 Thread Merlin Moncure
On Tuesday, October 1, 2013, David E. Wheeler wrote: > On Oct 1, 2013, at 3:56 PM, Merlin Moncure 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): >> >

Re: [HACKERS] No Index-Only Scan on Partial Index

2013-10-01 Thread David E. Wheeler
On Oct 1, 2013, at 3:56 PM, Merlin Moncure 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

Re: [HACKERS] No Index-Only Scan on Partial Index

2013-10-01 Thread Merlin Moncure
On Tue, Oct 1, 2013 at 5:35 PM, David E. Wheeler wrote: > Hackers, > > I was trying to figure out why a query was not doing an index-only scan on a > partial index, when Josh Berkus pointed to this issue, reported by Merlin > Moncure: > > > http://www.postgresql.org/message-id/CAHyXU0x1OGao48

[HACKERS] No Index-Only Scan on Partial Index

2013-10-01 Thread David E. Wheeler
Hackers, I was trying to figure out why a query was not doing an index-only scan on a partial index, when Josh Berkus pointed to this issue, reported by Merlin Moncure: http://www.postgresql.org/message-id/CAHyXU0x1OGao48WajAfUsbXqkUDLf=_6ho6hlmb8dsfkwda...@mail.gmail.com In short, the plan