Which is more efficient READ/FIND?

Hi all,

Can anyone tell me out of READ and FIND which is more efficient and why?

Thanks

It depends! A rule of thumb is:

READ is for mass data operations
FIND is good for finding and sorting less records

See also:
http://adabas.forums.softwareag.com/viewtopic.php?t=862

The way I would put it: if you want to zero in on a specific group of records, use FIND. If you want to browse through a range of records, use READ.

Examples:
Find out how much a particular employee makes – use FIND
Output an employee phone book – use READ EMPLOYEES BY LAST-NAME
Verify that every employee has a valid ZIP code – use READ PHYSICAL (assuming ZIP is not a descriptor.)

What do you mean by"efficient" ?

  • efficient in lines of code and understanding
  • efficient in number of database calls
  • efficient in number of database io’s
  • efficient in response time / database duration
  • efficient in cpu usage of the database service
  • efficient in cpu usage of the natural program
  • efficient in accounting costs (which may be a mixture of the above)

and so on.

If you ask such a question, please provide an example.

Depends,

for example - if you have 1000 records

  1. and you intend processing most (more than say 80 % depends on the environment) use read. NOTE: The higher the number of records the higher the percentage should be.

  2. if you intend processing only a few records then use FIND

Another pre-emptive measure for assigning descriptors is,

If you are not sure you will use it as a descriptor define the field as a NON DESCRIPTOR with N and write your code as FIND (ADABAS will convert it into a READ) and later on if you decide that it should be a descriptor change only the ADABAS file - the programs will not need any change.

Good luck

Feroz Imtiaz

I disagree here, a growing number of records should see the percentage shrink, not rise.

Think about it,

TOTAL RECORDS RECORDS to PROCESS % USE


1000 800 80 READ
100,000 90,000 90 READ
100,000 50,000 50 READ / FIND

You are right, if it is READ LOGICAL and escape. For READ PHYSICAL maybe a FIND is better