mysql> explain select count(*) from message;
+----+-------------+---------+-------+---------------+--------+---------+------+----------+-------------+
| id | select_type | table | type | possible_keys | key | key_len
| ref | rows | Extra |
+----+-------------+---------+-------+---------------+--------+---------+------+----------+-------------+
| 1 | SIMPLE | message | index | NULL | status | 1
| NULL | 23051499 | Using index |
+----+-------------+---------+-------+---------------+--------+---------+------+----------+-------------+
Three queries return the same results.
That's never going to be fast because you're using innodb tables.
From a previous post:
> Then you can imagine how much time sql such as "select a,b from
> table_name where c='d'" will take.
>
> I have a lot of tables like that. So my questions is:
> What's your practice to optimize tables like that?
I thought that's what you needed help with. ?
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php