Try OpenEdge Now
skip to main content
ABL Database Triggers and Indexes
Database Index Usage : Searching without index : When TABLE-SCAN is recommended instead of WHOLE-INDEX
 

When TABLE-SCAN is recommended instead of WHOLE-INDEX

The following example demonstrates when TABLE-SCAN is recommended instead of WHOLE-INDEX
DEFINE TEMP-TABLE mytable NO-UNDO
FIELD name AS CHARACTER
FIELD id1 AS INTEGER
FIELD qty AS INTEGER
FIELD id2 AS INTEGER
INDEX idix id1.
FOR EACH mytable TABLE-SCAN:
myaggregate_function(mytable)
END.
If TABLE-SCAN is used, AVM scans all the records by accessing record blocks only; while if TABLE-SCAN is not specified, then WHOLE-INDEX is used and AVM scans all the records by accessing index blocks and record blocks. So instead of accessing index blocks and record blocks, with TABLE-SCAN, you only access the record blocks.