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.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.