Strange DISTINCT !

Поиск
Список
Период
Сортировка
От Jean-Christophe Boggio
Тема Strange DISTINCT !
Дата
Msg-id 15724787382.20010820165133@thefreecat.org
обсуждение исходный текст
Ответы Re: Strange DISTINCT !
Список pgsql-sql
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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Mark Mikulec
Дата:
Сообщение: Sequential select queries...??
Следующее
От: fimbulvetr@lycos.com (fimbulvetr)
Дата:
Сообщение: Re: `postgresql.conf' has wrong permissions???