|
Actually these two statements are not the same. First one will return all combinations: WRITE/SCREEN-REC, WRITE/SCREEN-FILE , READ/SCREEN-REC, READ/SCREEN-FILE Second one will only return: WRITE/SCREEN-REC, READ/SCREEN-FILE Alexei Pytel always speaking for myself "Joe Pluta" <joepluta@PlutaBro To: <midrange-l@midrange.com> thers.com> cc: Sent by: Subject: RE: Spool file journalling midrange-l-admin@m idrange.com 10/29/2002 09:56 AM Please respond to midrange-l Here's why I have problems with SQL. Take a look at the following statements: select * from sccc1 a, sccc1 b where a.c1flag3 = 'V' and a.c1source in ('WRITE', 'READ') and a.c1kwid = b.c1prnt and b.c1source in ('SCREEN-REC', 'SCREEN-FILE') select * from sccc1 a, sccc1 b where a.c1flag3 = 'V' and ((a.c1source = 'WRITE' and a.c1kwid = b.c1prnt and b.c1source = 'SCREEN-REC') or (a.c1source = 'READ' and a.c1kwid = b.c1prnt and b.c1source = 'SCREEN-FILE')) Both are trying to do the same thing - use a COBOL cross-reference to determine READs and WRITEs to a workstation. READs use the file name, WRITEs use the record name. The references to "c1kwid/c1prnt", which are the same in both queries, are used to make sure the cross-reference lines are related. The first one, which is a little more inclusive (it would include READs on the record and WRITEs to the file) runs in milliseconds. The second one I fired off and it chewed up 73% of my machine for over 30 seconds before I shut it down. (Eventually CFINT kicks in and grinds the thing to a halt, even though it's the only job on the machine.) My observation has several parts: 1. Would any of the SQL gurus like to point out any serious problems in my syntax? Are there better ways to do this? 2. I looked at the joblog under debug to determine the access paths, and while the optimizer recommends I create a logical over C1SOURCE, the two statements use the exact same paths. 3. Why would what seems like a pretty simple syntax change cause such drastic difference in response time? =======UPDATE========= By adding the logical over C1SOURCE as the optimizer suggested, the second runtime dropped to milliseconds. Evidently, the second syntax somehow causes the index to be rebuilt over and over again. Joe _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l or email: MIDRANGE-L-request@midrange.com 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-2024 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.