Using INDEXED-REPOSITION to improve query performance
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
If you anticipate jumping around in the result set using
statements such as GET LAST, you should add another
option to the end of your OPEN QUERY statement:
the INDEXED-REPOSITION keyword. If you do this,
your DEFINE QUERY statement must also specify the SCROLLING keyword.
If you don't open the query with INDEXED-REPOSITION,
then the AVM retrieves all records in sequence in order to satisfy
a request such as GET LAST. This can be very costly.
If you do use INDEXED-REPOSITION, the AVM uses
indexes, if possible, to jump directly to a requested row, greatly
improving performance in some cases. There are side effects to doing
this, however, in terms of the integrity of the results list, as
discussed in INDEXED-REPOSITION and field lists.