Re: No Index-Only Scan on Partial Index

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: No Index-Only Scan on Partial Index
Date: 2013-10-01 23:30:37
Message-ID: 76BCA8DC-048A-4631-A004-CBB152EE7FA0@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

Best,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2013-10-01 23:52:18 Re: insert throw error when year field len > 4 for timestamptz datatype
Previous Message Merlin Moncure 2013-10-01 22:56:19 Re: No Index-Only Scan on Partial Index