Re: No Index-Only Scan on Partial Index
От | David E. Wheeler |
---|---|
Тема | Re: No Index-Only Scan on Partial Index |
Дата | |
Msg-id | 12972596-5190-4CAF-8169-2EDF48483E42@justatheory.com обсуждение исходный текст |
Ответ на | Re: No Index-Only Scan on Partial Index (Merlin Moncure <mmoncure@gmail.com>) |
Список | pgsql-hackers |
On Oct 2, 2013, at 5:07 AM, Merlin Moncure <mmoncure@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 > > ----------------------------------------------------------- > > 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... That rewards me with a bitmap heap scan: EXPLAIN select * from try where upper_inf(irange); QUERY PLAN --------------------------------------------------------------------------------------Bitmap Heap Scan on try (cost=935.63..2197.63rows=33333 width=68) Filter: upper_inf(irange) -> Bitmap Index Scan on try_upper_inf_idx (cost=0.00..927.30rows=50000 width=0) Index Cond: (upper_inf(irange) = true) But anyway, I still don’t understand why, if the function used to store the value is immutable (as upper_inf() is), why Postgresdoesn't do an index scan. Is this something that could be improved in the planner? Thanks, David
В списке pgsql-hackers по дате отправления: