Try OpenEdge Now
skip to main content
ABL Essentials
Using Queries : Defining and using queries : Identifying the current row in the query : Using INDEXED-REPOSITION to improve query performance
Using INDEXED-REPOSITION to improve query performance
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.