Kbase P93301: Does Progress perform a full table scan when executing a FIND FIRST Statement?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  17/10/2004 |
|
Status: Unverified
GOAL:
Does Progress perform a full table scan when executing a FIND FIRST Statement?
GOAL:
Why does Progress display the WHOLE-INDEX qualifier in the XREF file when compiling a program that contains a FIND FIRST Statement?
FIX:
No, Progress does not perform a full table scan when executing a FIND FIRST Statement. If there is no WHERE clause, then the first record in the index will be returned with no searching beyond that. However, if there is a WHERE clause and there are no indexed fields upon which to base the search, then the index will be used to get each record in turn until the WHERE clause is satisfied. So it says "WHOLE-INDEX" meaning nothing more was found to narrow things down.
e.g.: FIND FIRST customer WHERE address BEGINS "y".
This will look at the whole custNum index until the first address that begins with "y" is found.
e.g.: FIND FIRST customer.
This will look at the index and return the first entry with no further looking.
But the WHOLE-INDEX notation is based on what was in the WHERE clause and doesn't notice if it is a FIRST or LAST. If it is a LAST with no WHERE, it will switch the search to "prev" and find the "first" of the "prev" which is the LAST and will take only the one probe to get the record too.
So, Progress will say WHOLE-INDEX unless the WHERE clause produced some criteria that could be used to make a bracket in the index. In this case there is none, so it says WHOLE-INDEX.
Of course, just because it says WHOLE-INDEX in the XREF, does not mean that it is going to look at every record in the index. This is seldom the case. One cannot just blindly look for these and assume so. And likewise, the absence of WHOLE-INDEX does not mean that Progress will not scan the whole index.
For instance, FOR EACH customer WHERE custNum > 0, will scan the whole index, even though WHOLE-INDEX will not show up in the XREF file.