what if you had the OPENQRYF run against HISTRY4LA? 
 
---------------------------------
Booth Martin
http://www.martinvt.com
---------------------------------
-------Original Message-------
 
From: Midrange Systems Technical Discussion
Date: 03/30/04 10:51:09
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

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2022 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.