Home > Article > Backend Development > background-repeat mysql_num_rows VS COUNT efficiency problem analysis
Both mysql_num_rows and count(*) can count the total number, which one is better?
Or
When to use num_rows and count(*) respectively
An intuitive comparison
Test data:
Number of items: 139764 items
Data table size: 500M
Result:
fetch_num_rows time: 35.272329092026
count(*) time: 0.071956872940063
If the number is simply counted, of course it is count(*)
fetch_num_rows must traverse the database to find that the efficiency is lower than count(*)
The above introduces the analysis of background-repeat mysql_num_rows VS COUNT efficiency issues, including the content of background-repeat. I hope it will be helpful to friends who are interested in PHP tutorials.