On Fri, Jul 15, 2016 at 11:55 AM, Brian Piotrowski <
bpiotrowski@xxxxxxxxxxxxxxx> wrote:
The one thing I find strange is that when the index advisor tells us to
create an index based on key fields it will ask for the same index again
even though it was created.
You may have too many indexes....
The SQE will only look for indexes for a limited amount of time. I think
there's a way to tell if it times out (message when running in debug?)
Look for indexes that aren't used often...also look for indexes that can be
consolidated.
For instance,
idx1: fld1
idx2: fld1, fld2
You could possibly delete idx1. There are some complications, check out
this thread:
http://archive.midrange.com/midrange-l/200911/msg01013.html
As I understand it, with a query that contains ORDER BY FLD1, the SQE will
use idx1 for ordering. It won't use IDX2.
A query that has WHERE FLD1 = 'XXXX' can use either IDX1 or IDX2.
From personal experience, make sure you use all the keys. For instance, we
have only 1 location defined in our system. So location number is always =
0. I get the same results with both the following:
SELECT * FROM MYFILE WHERE ITEMNBR = 123
SELECT * FROM MYFILE WHERE LOCATION = 0 AND ITEMNBR = 123
But only the 2nd one will use an existing logical since the system is
designed to support multiple locations.
Which brings up another point. The existing logicals are all keyed
(LOCATION, ITEMNBR). Makes sense, all the RPG programs except to work
withing a given company.
Generally speaking, every RPG system I've seen is keyed
(LEAST_SELECTIVE, MORE_SELECTIVE, MOST_SELECTIVE)
which allows for a SETLL & READE using partial keys.
However, the SQE actually prefers
(MOST_SELECTIVE, MORE_SELECTIVE, LEAST_SELECTIVE)
I'm not sure that the advised index always has the best column order, it's
not perfect yet. :)
Charles
As an Amazon Associate we earn from qualifying purchases.