"Stevenson, Charles" <[EMAIL PROTECTED]> wrote: <snips> Which would you suppose is much faster: ... FOR I = 1 TO 100 EXECUTE 'SELECT VOC WITH TYPE = "V" COUNT.SUP' LOOP WHILE READNEXT ID NULL ;* GOSUB DO.STUFF REPEAT NEXT I ... or ... OPEN 'VOC' TO F ELSE STOP FOR I = 1 TO 100 SELECT F LOOP WHILE READNEXT ID READ REC FROM F, ID THEN IF REC[1,1]='V' THEN NULL ;* GOSUB DO.STUFF END END REPEAT ... Notice how much less work #2 (seemingly) does: ... Method 2 takes 2 or 3 times as longer to run than Method 1. It's not because VOC is a special file. I've tried it on other files, big and small. ... </snips>
It is my understanding that UniData (at least...don't know about UniVerse) cache's the SELECT in Method 1. You can see this from ECL by timing a huge select, then CLEARSELECT, then re-issue the original select. The second run will come back much quicker. Also, Method 2 reads the block from the file and reallocates the value of "REC" for each iteration, while Method 1 reads each block once and parses for ID's. Assuming 10-20 records per block (recommended file sizing from my UniData Admin trainer), that's a 10- to 20-fold savings on disk reads. --Tom Pellitieri ------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/