Subject Re: [ib-support] WHERE optimization
Author Svein Erling Tysvaer
At 14:40 13.02.2003 +0200, you wrote:
> >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?

That depends upon the plan of your query. If bill is not the first table of
your plan and you do have an index for bill.account_id that is selective,
then yes, I think performance would improve.

> >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've never read that... just assumed that the less you were selecting the
better. And what is less than a constant number? If what you've read holds
true, then I guess there is no real difference between the two.

Set