Hello, can someone explain to me why this query is so slow :

select distinct t.idmembre,p.datecrea
from   tmp_stat t,prefs p
where  p.idmembre=t.idmembre
limit  5;

And this one is so fast :

select t.idmembre,p.datecrea
from   (select distinct idmembre from tmp_stat) as t,
       prefs p
where  p.idmembre=t.idmembre
limit 5;
 
(I currently have idmembre as an index on tmp_stat and prefs)

How does DISTINCT work ? Is this a bug or a misconfigured index ?

--
Jean-Christophe Boggio                       
[EMAIL PROTECTED]                           -o)
Independant Consultant and Developer         /\\
Delphi, Linux, Perl, PostgreSQL             _\_V


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to