Subject RE: [ib-support] Min and Max and Indexes
Author Alan McDonald
make a descending index on the same field as well as the ascending one
BTW do not make a separate index for a field which is the primary key since
it already has a default asc index created. So if it is the PK, then delete
the second asc index and create one more desacending index
Alan

-----Original Message-----
From: Alexander Tabakov [mailto:saho@...]
Sent: Tuesday, 15 April 2003 11:35 PM
To: ib-support@yahoogroups.com
Subject: [ib-support] Min and Max and Indexes


Hi,

I have a query like this running in a SP:

select phone_code, phone_number
from tbl_phone_2
where contact_id = (select min(contact_id) from contact_phone where
party_id = :party_id)
into :phone_code, :phone_number;

So, there is an ASC index in table: "contact_phone" on contact_id
which is actually the table key. This query executes for about 40 sec.
with around 100K phones.

If I change the "min(contact_id)" to: "max(contact_id)" then it executes
for 2,5 sec.

I know it has something to do with the ascending index but I am not
sure.

Could you help me?

--
Best regards,
Alexander mailto:saho@...



To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/