'FOR EACH' faster then a 'FIND' is it True???

JTWilson

New Member
I was wonder if anybody knows anything about the possibility that a ‘FOR EACH’ is faster then a ‘FIND’ in some circumstances. Is this true? Of just for older version of Progress? Or because of the way each command does its index processing?



Any information would be great.


Cheers,
JTWilson
 
The FIND statement can only ever use one index. The FOR EACH statement can use multiple indexes.

Example
Table1
Field1
Field2
Index1 - Field1
Index2 - Field2

FIND FIRST Table1 WHERE Field1 EQ Value1 AND Field2 EQ Value2.
This will only use Index1.

FOR FIRST Table1 WHERE Field1 EQ Value1 AND Field2 EQ Value2.
This will use both Index1 and Index2.

To identify which indexes are being used, use the XREF option on your COMPILE statement.
 
Thanks for the info... But now for the really stupid question! Why not do the same kind of logic for a 'FIND' statement instead of writting the following:

For each table where
a=1 and
b=2 and
c=3
no-lock:
leave.
end.
if avail table then do:
....

Is there an advantage to the way the Find statement currently works???
 
Back
Top