On 19 Mar 2008, at 14:53, tedd wrote:
At 10:35 AM -0400 3/19/08, Nathan Nobbe wrote:
On Wed, Mar 19, 2008 at 9:42 AM, Andrew Ballard
<aballard@xxxxxxxxx> wrote:
That works; I'm just wondering why you went with a count on an
'ID' column
rather than COUNT(*).
ouch, it looks like im horribly wrong :O
mysql> select count(*) from table;
+----------+
| count(*) |
+----------+
| 361724 |
+----------+
1 row in set (0.90 sec)
mysql> select count(id) from table;
+------------+
| count(did) |
+------------+
| 361724 |
+------------+
1 row in set (4.56 sec)
-nathan
That surprised me as well.
I thought that (*) meant "look up everything" and would have figured
that (id) would have been quicker.
Using count(*) can be optimised, as can count(1) which is what I
usually use. Using a specific field is harder to optimise.
-Stut
--
http://stut.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php