Subject Re: [firebird-support] Re: How to plan a query
Author Dmitry Yemanov
danyschaer wrote:
>
> "Bitmap Heap Scan on "MOVI" m1 (cost=2745.55..700415.71 rows=739
> width=55)"
> " Recheck Cond: ("HECH" = 'P'::bpchar)"
> " Filter: (("TIPO" = '1'::bpchar) AND ("FECH" = (subplan)))"
> " -> Bitmap Index Scan on "MOVI_HECH" (cost=0.00..2745.37
> rows=147880 width=0)"
> " Index Cond: ("HECH" = 'P'::bpchar)"
> " SubPlan"
> " -> Result (cost=4.57..4.58 rows=1 width=0)"
> " InitPlan"
> " -> Limit (cost=0.00..4.57 rows=1 width=9)"
> " -> Index Scan Backward using "MOVI_PRFE"
> on "MOVI" m2 (cost=0.00..68.54 rows=15 width=9)"
> " Index Cond: ("PROC" = $0)"
> " Filter: (("FECH" IS NOT NULL) AND ("TIPO"
> = '1'::bpchar) AND ("HECH" = 'P'::bpchar))"

Well, I see that PostgreSQL is able to scan the ascending index
backwards in order to evaluate the MAX function. Very good.
Unfortunately, this isn't possible in Firebird, as its indices are
uni-directional. Perhaps a descending index on "FECH" would help here.


Dmitry