Subject | Re: [ib-support] Problem with plan selection - doesn't seem right (Resubmit) |
---|---|
Author | Arno Brinkman |
Post date | 2002-12-17T09:56:18Z |
Hi,
An index for MAX() is used when the ORDER of the query is determined.
for example: PLAN (ORDERSD ORDER ORDERSDBYSEQNUM)
But because the resultset is depended from od_om_id no index can be used for
the MAX(). Indices for Aggregate functions are added to the sort-clause.
Regards,
Arno
> how can this possibly be the best index? Michael is selecting MAX and hasNo, Sean is right.
> defined a descending index. Even if there is a couple of duplicates, I
> would believe "ORDERSDBYSEQNUM" to be the best choice.
An index for MAX() is used when the ORDER of the query is determined.
for example: PLAN (ORDERSD ORDER ORDERSDBYSEQNUM)
But because the resultset is depended from od_om_id no index can be used for
the MAX(). Indices for Aggregate functions are added to the sort-clause.
> Are you saying that Fb/IB would choose "ORDERSDBYSEQNUM" if he changed itto
> CREATE DESCENDING INDEX ORDERSDBYSEQNUM ON ORDERSD (OD_OM_ID, OD_SEQNUM,Only if it has an better selectivity.
> OD_ID);?
Regards,
Arno