&NDBSCAN can be misused. The scan limits discussed previously are designed to prevent excessive use of resources. When designing applications that use &NDBSCAN, the following should be taken into account:
NAME = 'SMITH' AND ADDRESS CONTAINS 'STREET'
PRESENT and ABSENT use keys if possible. PRESENT makes better use of keys. LIKE uses keys if there are non-special ('_', '%') characters at the front of the pattern. It might still need to examine the actual record.
The CONTAINS operator always requires records to be read to evaluate success or failure. If you are performing many keyword searches of text using CONTAINS, consider storing the words of the text field as individual, keyed fields. These can then be searched for directly. For example the following statement scans the entire database:
DESCRIPTION CONTAINS 'WORD'
If, however, as well as field DESCRIPTION, you had fields DESCWD01-DESCWD10, all keyed, containing the individual words of the field DESCRIPTION (&PARSE could be used), you could code the following statement which could use keys:
ANY DESCWD* = 'WORD'
This processing can consume large amounts of I/O, as well as storage for the sort keys, and can take significant time.
Correlated scans can perform multiple passes over the database. This is because an inner scan can be called once for every record in the NDB, and it too can read the NDB, or a large portion of it.
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |