When you read the index, you are doing a direct read.
When on your second pass you are reading some other field as part of your 
select criteria, you are using the index, which is layed down sequentially, to 
access a non-sequential file, causing thrashing.

In other words, in order to determine if your zip code list also has the 
situation "foreign country" or whatever, you are reading each record, which 
you've picked up quickly from an index, but now you're drilling down to each 
individual record to check this second criteria.  When you do that read, you 
are not doing it, in any manner like the way the records are layed on the disk. 
 That causes thrashing.



-----Original Message-----
From: Steve Romanow <slestak...@gmail.com>
To: U2 Users List <u2-users@listserver.u2ug.org>
Sent: Tue, Oct 25, 2011 3:07 pm
Subject: Re: [U2] UniBasic Question


But you are potentially reducing your input set for the 2nd criteria
y a large margin correct?
I've never considered alt key + non-indexed usage to create disk thrash.
When you select on an alternate key index, you are reading the file,
ut (in Udt at least) an X_myfile binary file.  So you are doing a
irect read for the matching keys.  It has no knowledge of the file
ayout.

On Tue, Oct 25, 2011 at 6:01 PM, Wjhonson <wjhon...@aol.com> wrote:

 Yes yes and no.

 If you execute a SSELECT on an indexed field, and don't specify NO.INDEX and 
o NOT refer at all to any other fields in the file, then index does NOT read 
he record to see if it even actually exists.  It just retrieves the list of 
eys from the index.

 If you specific a SSELECT on an indexed field and ALSO specify some other 
ield criteria, then the select is *supposed* to use the index field FIRST to 
etrieve the list of keys and ONLY THEN read each record to see whether it 
atches the other criteria.  So the "first pass" if you will should be lightning 
ast, but then IF your other criteria makes it traverse the majority of the file 
ou are in for big Trouble with a "T" that rhymes with "P" that stands for 
Pool".

 The reason you are in for trouble in this last case, is that traversing the 
ajority of the file causes Disk Thrashing which is bad very bad very very bad. 
It causes this because you are forcing the system to reference the records 
ut-of-disk-order.  So it's jumping, jumping, jumping all over the disk in a 
elter skelter summer swelter.

 You want to avoid that.
 _______________________________________________
 U2-Users mailing list
 U2-Users@listserver.u2ug.org
 http://listserver.u2ug.org/mailman/listinfo/u2-users

______________________________________________
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to