If there is an index on the field in question and the optimizer decides to 
use it, it will "stop" when it's found, because finding it is the normal 
index processing that uses the B-tree search mechanism - same as a CHAIN, 
basically.
If there is no index, then there are alternatives, including creating a 
temporary index or a table scan. Turn on debug to see what the optimizer 
chose (STRDBG without a program specified, CHGQRYA QRYTIMEOUT(0), IIRC, 
choose C for cancel when the message appears, then check the job log for 
optimizer messages).
No SQL database will do well without supporting indexes for single-record 
selection situations. Things get more complicated, as in the other thread 
on SQL recently. Here the old iSeries optimizer did not do as well as even 
DB2 on AIX, which had different ways to get an access plan. There were 
times with JOINs that iSeries would do 10 times more probes to the tables 
than AIX does for the same statement. This is why there is now a new query 
engine (optimizer) that can take advantage of statistics (never had them 
explicitly before) and other more modular ways of creating access plans, 
inspired by techniques on the other versions of DB2. This is ongoing, and 
not everything is handled by this new optimizer yet. You have to use the DB 
monitor to figure out whether the new engine was used.
Vern
At 07:37 PM 1/20/2005, you wrote:
> If the field is a unique key, it got to be an index.
> If it is an index, then table scan is not needed - so there is no issue.
>
> Do I miss something here?
>
Yes, my original question.
Which was can one assume _100%_ that the processing will stop once the 
record has been located.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
 
As an Amazon Associate we earn from qualifying purchases.
	
 
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.