Subject Re[2]: [ib-support] WHERE optimization
Author Alexander Tabakov
>1) Is bill.service_id selective? I.e. does there only exist one or a few
>rows in the table with each value? If not, this field should not be indexed.

Actually bill.service_id is not very selective. Do you think there will be some
performance gain if I delete the index on bill.service_id?

>2) Why do you use "not exists (select * from tbl_invalid inv where
>inv.party_id = pty.party_id)"? Change it to "not exists (select 1 from
>tbl_invalid inv where inv.party_id = pty.party_id)".

I read somewhere that using "select * ..." in cases like this is
faster, but I will try "select 1 ..." as well.

>I think this is determined by the plan. The plan tries to retrieve the
>records as cheap as possible, and will start by evaluating what it
>perceives to be the most restrictive predicate having an index (please
>correct me if I'm wrong).

I don't know. What I know is that Oracle, for example, evaluates the
predicates in the WHERE clause from the last to the first one.
So, I wanted to know if Interbase does something similar :)

Best regards,
Alexander mailto:saho@...