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 mmonc...@gmail.com 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-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 3, 2013, at 10:50 AM, Josh Berkus j...@agliodbs.com 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.

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

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

[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

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 da...@justatheory.com 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:

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 mmonc...@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