Last update: 7 January 2005
READ / FIND / HISTOGRAM
What is better?
Very often, people asked whether it is better to use READ, READ(1), FIND, FIND(1), or HISTOGRAM. Kelly Jones, I know this ADABAS expert since the 80s, explained very well the differences.
ADABAS - as of 7.4.2 - does not store the number of ISNs for each value in the inverted list. In a Normal Index block ADABAS contains the value, count of ISNs in the block, and a list of ISNs - but this is not the total number of records with the same index value.
As a test I ran a HISTOGRAM(1) against a descriptor (single field) which returned the value 10,200 in *number. As reported by APAS, the first time I ran the program it issued 17 associator I/Os, a rerun a few minutes later it required 11 an immediate rerun required 0.
Based on discussions over the years, there is no Golden Rule when attempting to choose between READ(1), HISTOGRAM(1) and FIND NUMBER.
All commands will require I/O (at least logical) for
Differences between the commands include some of the following.
Jim Wisdom from Boston University added some outstanding statements to this issue:
Without knowing the specific data on any file, the question we are trying to answer is "Is record X on a file" not "Is record X on a file for which I may write the program 'look up' routine one way for file A but another way for file B". The READ solution should never require more than 7 physical I/Os. Any other Natural approach can lead to easily requiring more, depending on the data. How many programmers walk around knowing whether or not ISN lists span blocks? Or how these lookups work when the pointer you are looking for is NOT in the list? Since I don't want to be intrinsically involved in specific data records nor have the program work better in 2004 than it will in 2005, I have always concluded that the overall best approach is READ (1) or READ with ESCAPE.