|
Eric, Ah, I hadn't thought of that. I know there are two different optimizers. But I'm not aware of the older non-SQL one not being able to use EVIs. EVIs were introduced before the optimizers split. Do you know for sure they wouldn't be used with OPNQRYF? Point of fact for Rick; you'd be better off using embedded SQL so that you're taking advantage of the better optimizer. Charles > -----Original Message----- > From: Delong, Eric [mailto:EDeLong@xxxxxxxxxxxxxxx] > Sent: Tuesday, March 30, 2004 3:12 PM > To: 'Midrange Systems Technical Discussion' > Subject: RE: query optimizer revisited - this shouldn't be this hard! > > > Charles, > > I think EVIs are not allowed with OPNQRYF. These were among > the first "SQL > only" features added to DB2/400. > > Eric DeLong > Sally Beauty Company > MIS-Project Manager (BSG) > 940-898-7863 or ext. 1863 > > > > -----Original Message----- > From: CWilt@xxxxxxxxxxxx [mailto:CWilt@xxxxxxxxxxxx] > Sent: Tuesday, March 30, 2004 1:53 PM > To: midrange-l@xxxxxxxxxxxx > Subject: RE: query optimizer revisited - this shouldn't be this hard! > > > Rick, > > It's possible that the access path it built was over a > temporary table and > was simply used for ordering purposes. > > In other words, it did a full table scan to select the records into a > temporary table. Then built an access path so it could do > the ordering. > > I'm no expert, but I seem to recall being told that when > using *NE, a full > table scan is pretty likely unless the optimizer knows > exactly how many rows > don't have the value you're comparing to. > > Instead of one index over multiple columns, it may work > better if you have > multiple (EVI?) indexes over single columns. > > HTH, > Charles > > > > -----Original Message----- > > From: rick.baird@xxxxxxxxxxxxxxx [mailto:rick.baird@xxxxxxxxxxxxxxx] > > Sent: Tuesday, March 30, 2004 11:51 AM > > To: midrange-l@xxxxxxxxxxxx > > Subject: query optimizer revisited - this shouldn't be this hard! > > > > > > Ok, now i'm really starting to get frustrated. > > > > I have an opnqryf statement that I want to run quicker. > > > > OPNQRYF FILE((HISTRY4)) > > QRYSLT('HPEROD *EQ "06" *AND LMRKTC *NE "00" *AND HITEM *NE 0') > > KEYFLD((HITEM) (LMRKTC)) > > > > the query optimizer said: build this index: > > > > HPEROD, LMRKTC, HITEM (the order is wrong, but I'll take > > it's word for it) > > > > i create an index: > > > > CREATE INDEX HISTRY4LA > > ON HISTRY4 (HPEROD, LMRKTC, HITEM) > > > > and re-run the query. It tells me it considered my index, > > but rejected it > > because of reason 5: > > 5 - The keys of the access path did not match the fields > > specified for > > the > > ordering/grouping criteria. > > > > ok, reasonable enough. so I change the opnqryf and the index > > to match each > > other better, while having the same results. > > > > CREATE INDEX HISTRY4LA > > ON HISTRY4 (HPEROD, HITEM, LMRKTC) > > > > and > > > > OPNQRYF FILE((HISTRY4)) > > QRYSLT('HPEROD *EQ "06" *AND HITEM *NE 0 *AND LMRKTC *NE "00"') > > KEYFLD((HPEROD) (HITEM) (LMRKTC)) > > > > I ran again, and it says it considered my index, but rejected > > it because of > > reason 4. > > 4 - The cost to use this access path, as determined by the > > optimizer, was > > higher than the cost associated with the chosen access method. > > > > So I checked to see what access path WAS built, and this is > > what it told > > me. > > > > HPEROD ASCEND, HITEM ASCEND, LMRKTC ASCEND. > > > > BUT THAT'S MY ACCESS PATH!!! why did it build another access > > path exactly > > like mine? > > > > This shouldn't be rocket science, but it's obviously harder > > than it looks. > > I'm about to just start building single purpose logicals and > > be done with > > it. > > > > help please.... > > > > Rick > > > > > > _______________________________________________ > > This is the Midrange Systems Technical Discussion > > (MIDRANGE-L) mailing list > > To post a message email: MIDRANGE-L@xxxxxxxxxxxx > > To subscribe, unsubscribe, or change list options, > > visit: http://lists.midrange.com/mailman/listinfo/midrange-l > > or email: MIDRANGE-L-request@xxxxxxxxxxxx > > Before posting, please take a moment to review the archives > > at http://archive.midrange.com/midrange-l. > > > _______________________________________________ > This is the Midrange Systems Technical Discussion > (MIDRANGE-L) mailing list > To post a message email: MIDRANGE-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/midrange-l > or email: MIDRANGE-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/midrange-l. > > > _______________________________________________ > This is the Midrange Systems Technical Discussion > (MIDRANGE-L) mailing list > To post a message email: MIDRANGE-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/midrange-l > or email: MIDRANGE-L-request@xxxxxxxxxxxx > 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.