Subject Re: [ib-support] Index Help
Author Svein Erling Tysvaer
Hi Sivaraman,

>SELECT DISTINCT A.LCL_KEY FROM AccUnit A,
>BATCHDTL BD WHERE
>A.ARRANGEMENTID=BD.ARRANGEMENTID ORDER BY A.LCL_KEY

the index you already have on AccUnit can only be used in this query if it
is the first field in the index, i.e.

CREATE INDEX <somename> ON AccUnit(ARRANGEMENTID, <somefield>,
<someotherfield>) will use an index, whereas
CREATE INDEX <somename> ON AccUnit(<somefield>, ARRANGEMENTID,
<someotherfield>) will not.

If ARRANGEMENTID is not the first field of this index, then another index
on the field in either AccUnit or BATCHDTL would help if ARRANGEMENTID is
selective (if it is unique then you should definitely index it, whereas if
it just contain a boolean value, then an index will just slow down things
even more).

HTH,
Set

At 06:04 30.05.2003 +0000, you wrote:
>Hello,
>My Application is very slow.I am sure that this is the problem of
>indexes in the databases.
>We are not creating the foreignkey reference.So the index is not
>created for the Referenced table.
>We asked our DBA to create the Index and he created Secondary
>indexes.Now it is lit bit o.k.
>But still some tables are not having the indexes.This is my
>query.When i test this query in
>the volume testing,it is taking 5 minutes to fetch the records.
>
>
>SELECT DISTINCT A.GRP_RCON_KEY FROM ACCUnit A,
>BATCHDTL BD WHERE A.ARRG_ID=B.ARRG_ID
>ORDER BY A.GRP_RCON_KEY
>
>There Arrangementid field in both AccUnit and BatchDtl table is not
>having the seperate index.But we have the composite key for three
>fields in the AccUnit table.One field is Arrangementid.
>If we create index for this field in these two tables, will it be
>fast?
>I have to give the proper explanation before send the request to DBA
>for
>creating indexes.I don't know more about indexes.
>
>
>Thanks in Advance..
>
>Sivarman