[nycphp-talk] Re: MySQL doubt
Faber Fedor
faber at linuxnj.com
Fri Jan 14 09:31:39 EST 2005
On 14/01/05 00:43 -0500, Adam Fields wrote:
> This won't show anything different
Looks different to me:
mysql> explain select count(*) from foobar ;
+------------------------------+
| Comment |
+------------------------------+
| Select tables optimized away |
+------------------------------+
1 row in set (0.01 sec)
mysql> explain select count(row_names) from r1000g_meanVectors ;
+--------------------+------+---------------+------+---------+------+------+-------+
| table | type | possible_keys | key | key_len | ref | rows | Extra |
+--------------------+------+---------------+------+---------+------+------+-------+
| foobar | ALL | NULL | NULL | NULL | NULL | 149 | |
+--------------------+------+---------------+------+---------+------+------+-------+
1 row in set (0.01 sec)
> I hope that it would optimize this to reading off an internal row
> counter rather than fetching all of the rows and counting them. In the
> former case, they should be the same. If it's doing the latter,
> count(field) will be faster.
The first one in my example says to me "I don't even need to look at the
table, I already know the answer" and the second one tells me the table
has to be looked at.
--
Regards,
Faber
Linux New Jersey: Open Source Solutions for New Jersey
http://www.linuxnj.com
More information about the talk
mailing list