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
cat@thefreecat.org -o)
Independant Consultant and Developer /\\
Delphi, Linux, Perl, PostgreSQL _\_V