Subject | Re: Very Slow Query |
---|---|
Author | las19682000 |
Post date | 2002-08-06T22:18:59Z |
Didnt work.
Thanks anyway
Thanks anyway
--- In ib-support@y..., Daniel Rail <daniel@a...> wrote:
> At 06/08/2002 05:37 PM, you wrote:
> >Hi, i have about 400,000 records on my table Cliente and about
> >400,000 on
> >Cliente_Mailing and when i run this query:
> >
> >Select Cliente.Nome
> > From Cliente,Cliente_Mailing Where
> > (Cliente_Mailing.id_mailing=9 or Cliente_Mailing.id_mailing=8)
> > and Cliente.id_cliente=Cliente_Mailing.id_cliente
> > Order by nome
> >
> >It Takes about 24 minutes
> >
> >But if i test only Cliente_Mailing.id_mailing=9 like this:
> >Select Cliente.Nome
> > From Cliente,Cliente_Mailing Where
> > (Cliente_Mailing.id_mailing=9)
> > and Cliente.id_cliente=Cliente_Mailing.id_cliente
> > Order by nome
> >
> >it takes 1 second
> >
> >Why and how to speed the top query
>
> Try:
>
> SELECT Cliente.Nome
> FROM Cliente
> WHERE EXISTS (SELECT *
> FROM Cliente_Mailing
> WHERE (Cliente_Mailing.id_cliente=Cliente.id_cliente)
> AND (Cliente_Mailing.id_mailing in [8, 9]))
> ORDER BY Nome
>
>
> Daniel Rail
> Senior System Engineer
> ACCRA Group Inc. (www.accra.ca)
> ACCRA Med Software Inc. (www.accramed.ca)