Re: [SQL] Strange DISTINCT !

2001-08-20 Thread Stephan Szabo
On Mon, 20 Aug 2001, Jean-Christophe Boggio wrote: > 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 > fr

Re: [SQL] Strange DISTINCT !

2001-08-20 Thread Oleg Lebedev
I think this is because if you remove duplicates before joining the tables, then you would join smaller tables, therefore cutting the cost of the join (and later sorting and removing duplicates). Say tmp_stat has the size of 1000 and 10 duplicates on the everage for each distinct tuple. Also, if t