|
Posted by gosha bine on 07/26/07 10:23
On 26.07.2007 09:51 Toby A Inkster wrote:
> cover wrote:
>
>> $query = "SELECT DISTINCT status
>> FROM $table";
>
> Most databases optimise GROUP BY better than DISTINCT. Generally speaking,
> if you can avoid DISTINCT, you should: it forces the database engine to
> retrieve rows and then discard them, whereas often, especially with
> well-indexed columns, the engine will be able to do smarter things with
> GROUP BY.
Don't know about "most" ones, mysql docs explicitly says they're equivalent
http://dev.mysql.com/doc/refman/5.0/en/distinct-optimization.html
--
gosha bine
makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
[Back to original message]
|