× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



While not answering your question specifically, my answer may lead to a
solution in a roundabout way.

Because you have no JOIN clause (or at least not one you've reproduced),
this looks like a subset of a cartesian query (a cartesian query is one
where all rows of one table are returned for each row of another, joined
table).

On a cartesian join, if you have 1000 rows in one table and 500 rows in
your other table, you'll have 500,000 rows in the result.  Then, after the
join, you begin reducing your count by the WHERE clause.  I *SUSPECT* that
the first WHERE clause will (why, I don't know) cause the selection /
omission to occur before the JOIN takes place (?).

I can't believe this produced the results you wanted.  What am I missing?


Add a JOIN BY clause, and you might see these differences disappear.






"Joe Pluta" <joepluta@PlutaBrothers.com>@midrange.com on 10/29/2002
10:56:05 AM

Please respond to midrange-l@midrange.com

Sent by:    midrange-l-admin@midrange.com


To:    <midrange-l@midrange.com>
cc:
Subject:    RE: Spool file journalling


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?






As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.