Pavel Stehule <stehule@kix.fsv.cvut.cz> writes:
> Bitmap Heap Scan on fx (cost=12.00..473.00 rows=998 width=4) (actual
> time=0.516..3.855 rows=1035 loops=1)
> Recheck Cond: (((i >= 1) AND (i <= 10)) OR ((i >= 10) AND (i <= 1)))
> -> BitmapOr (cost=12.00..12.00 rows=1000 width=0) (actual
> time=0.377..0.377 rows=0 loops=1)
> -> Bitmap Index Scan on fxxx (cost=0.00..6.00 rows=500 width=0)
> (actual time=0.362..0.362 rows=1035 loops=1)
> Index Cond: ((i >= 1) AND (i <= 10))
> -> Bitmap Index Scan on fxxx (cost=0.00..6.00 rows=500 width=0)
> (actual time=0.007..0.007 rows=0 loops=1)
> Index Cond: ((i >= 10) AND (i <= 1))
> Total runtime: 6.412 ms
> better is sort operands before and next test. Without it, between produce
> condition which is allways false. But planner dont recognize it.
No, but the btree index code does --- notice the very small actual time
there. I don't think there's anything seriously wrong with the above
plan.
regards, tom lane