Subject | Very Slow Query |
---|---|
Author | las19682000 |
Post date | 2002-08-06T20:37:58Z |
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
Thanks
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
Thanks