Brent Baisley wrote:
Basically, you can't, it's a limitation of the InnoDB format. If you change the table type to MyISAM, that query would be almost instantaneous. But you are probably using InnoDB for a reason, so you may be stuck if you want a record count.

As Brent said, there is no way to optimize count(*) with InnoDB. However, there are a couple of workarounds that can help:


* Upgrade to 4.0 and enable the query cache. If the cache is large enough, count(*) will be executed all the way only the first time after you've updated the table. If you do not update a lot, this would help.

* Create a record count summary table that will store the value of count(*) and update it in your application every time you insert or delete records

--
Sasha Pachev
Create online surveys at http://www.surveyz.com/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to