Replacing FIND FIRST for performance
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
When coding ABL applications for the DataServer, FIND FIRST statements
can often be replaced with other ABL statements to greatly improve
performance. OPEN QUERYs and dynamic FINDs are
significantly more efficient. Likewise, using FOR FIRST in
place of FIND FIRST can improve
performance when retrieving a single record with NO-LOCK.
For example, if your application uses the following FIND FIRST code:
|
The code can be replaced with the following for significant performance gains:
|
In the case of the FOR FIRST,
the record is not reliably available beyond the end of the FOR FIRST loop
unless a LEAVE is specified. Similar performance
advantages can be gained when retrieving last record as well.