Generally speaking, you've got it right, John. A few caveats, notes, gotchas:
- Use EXPLAIN keyword to get RetrieVe to show you what it is going to do. - If a field is indexed, and no select list is active when the retrieve command starts, the index will be applied before any actual select & data lookup on the primary data file. - If your 'products' field were an expensive calculated value like a trans() or t-correlative to another file or an expensive subroutine call, you should probably do it after the selection on simple stored data. - If you have multiple passes over the same file, e.g., A SELECT or 2 followed by LIST, leave the list unsorted until the final pass. That way the intermediate select lists remain in disk order, resulting in less disk reads if multiple records happen to hash to the same group. - Use parentheses to better control your selection criteria. - If it gets too complicated and you want explicit control, pack all your selection criteria into one I-descriptor that returns a true or false. That way it is just basic code that you and the pgmr that follows you 2 years from now can easily understand and maintain. cds -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aherne, John Sent: Thursday, February 24, 2005 12:52 PM To: u2-users@listserver.u2ug.org Subject: [U2] Order of criteria Hi All, Does the order of criteria matter in a select or list statement, or is the execution order arbitrary? For example, if I wanted to select vendors who sell apples in Denver, is "Select vendors with location='Denver' and products='Apples'" the same as "Select vendors with products='Apples' and location='Denver'" Given that out of 300 vendors, 50 sell apples, and 100 are in denver, and 15 of those in Denver sell apples. If it does matter, should I put the criteria that is likely to return the smallest result set first? TIA, John ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/