When you COUNT(*) it takes in count column indexes, so it will be the best result. Mysql with MyISAM engine actually stores row count, it doensn't count all rows each time you try to count all rows. (based on primary key's column) Using PHP to count rows is not very smart, because you have to send data from mysql to php. Why do it when you can achieve the same on the mysql side? If the COUNT(*) is slow, you should run EXPLAIN on the query, and check if indexes are really used, and where should they be adde_
Agree. PHP in no way can count the db records. Somehow it will be using the mysql functions or sql to count behind the scene
You can use MySQL_num_rows if you want to count numbe of rows in the php still you can use count(*) and store it in the alias and read the variable from the array in order to get count , but according to e MySQL_num_rows is th best way