Subject Re: How to plan a query
Author danyschaer
Thank you Alexandre;

But ...

> The problem resides on PROC NATURAL, from what I understood from the
> query, the outer query has no where clause, so there is nthing to do
> besides scan all records...
>
> If PROC table is huge, certainly, it would take time to execute.
>

Please, compare both examples (called FIRST and NEXT); both uses the
same PLAN at that point (PROC NATURAL), but FIRTS is very fast and NEXT
is very slow.

The where clause of PROC is returning only 23 records. The problem
comes when I have to find the max(FECH) for each PROC in MOVI.

Dany