Re: PHP/mySQL question about groups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Feb 6, 2008 11:20 PM, Nathan Nobbe <quickshiftin@xxxxxxxxx> wrote:
> On Feb 6, 2008 10:59 PM, Andrew Ballard <aballard@xxxxxxxxx> wrote:
>
> > Of course, in this case you could just avoid all the confusion with
> > this statement as well:
> >
> > SELECT DISTINCT name, size
> > FROM    wine
>
> im not sure why, but i think distinct is typically way slower than group by.
>
> -nathan
>

I can't really say for MySQL, but in my experience I'd say "it
depends." It seems to me that for this case they should be about the
same, as it's always been my thinking that GROUP BY did a DISTINCT
implicitly. However, I don't really know the internals of any DB
platform so I can't confirm that. I ran DESCRIBE on a couple different
tables, and they both return the same plan. I don't see any notable
difference in the queries either. However, I'll leave it to the OP to
test and see if one is better for his question.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux