Different Count and Mysql_num_rows in MYSQL

Wahyu Raja Reply 7:25 AM
Use COUNT, internally the server will process the request differently.
When doing COUNT, the server will only allocate memory to store the result of the count.
When using mysql_num_rows, the server will process the entire result set, allocate memory for all those results, and put the server in fetching mode, which involves a lot of different details, such as locking.
Think of it like the following pseudo scenario:
1) Hey Bob, how many people are in the class room? (count)
2) Hey Bob, get me a list of all the people in the classroom, ... I'll calculate the number of people myself (mysql_num_rows)

Related Posts

mysql 3134496593168491103
Facebook Comments by Media Blogger

Post a Comment


Ikuti Channel Youtube Aku Yaa.. Jangan Lupa di subscribe. Terima kasih.

Google+ Followers

Popular Posts