Subject Re: [firebird-support] Count in Join slowly when using 'in'
Author Kjell Rilbe
Helen Borrie wrote:
> At 01:21 PM 14/02/2005 +0000, you wrote:
>>I want to do something like:
>>Select Count(*) From Employee E Inner Join Employer R On
>>(E.EmployerId=R.Id) Where R.Id In (10,20,30)
>>
>>This is very slow; When I do Where R.Id=10 it is very fast. What is
>>wrong with my query?
>
> Use the left-hand table for the IN() test:
> Select Count(*) From Employee E Inner Join Employer R On
> (E.EmployerId=R.Id) Where E.Id In (10,20,30)

I assume Helen means:

Select Count(*) From Employee E Inner Join Employer R On
(E.EmployerId=R.Id) Where E.EmployerId In (10,20,30)

Not sure why it would help - anyone willing to explain? Might be
relevant to what I'm doing too...

Kjell
--
--------------------------------------
Kjell Rilbe
Adressmarknaden AM AB
E-post: kjell.rilbe@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64