Subject | Re: [firebird-support] Count in Join slowly when using 'in' |
---|---|
Author | Kjell Rilbe |
Post date | 2005-02-14T14:13:40Z |
Helen Borrie wrote:
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
> At 01:21 PM 14/02/2005 +0000, you wrote:I assume Helen means:
>>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)
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