[nycphp-talk] Re: MySQL doubt
Hans Zaunere
zaunere at gmail.com
Sat Jan 15 02:41:47 EST 2005
> > Both queries have the same where clause.
>
> That's what I missed. I too would have expected the parser to execute
> the WHERE clause before the SELECT clause.
>
> Is this another case where MySQL is nonstandard?
It is standard. MyISAM has a special optimization that allows a COUNT(*) to
read the table definition directly, whereas most cases, this cannot hold
true. For example, a row with a NULL in a COUNT(somecolumn)'d isn't
counted. A WHERE or GROUP BY generally requires a real calculation to be
performed because the contents of each row cannot be assumed, and for InnoDB
tables, this can never be assumed because of multi-versioning.
See http://dev.mysql.com/doc/mysql/en/GROUP-BY-Functions.html
---
Hans Zaunere
President, Founder
New York PHP
http://www.nyphp.org
Gmail: The 1gb spam catcher
More information about the talk
mailing list