php - Using count(*) vs num_rows -
to number of rows in result set there 2 ways:
is use query count
$query="select count(*) count some_table type='t1'";
and retrieving value of count.
is getting count via num_rows(), in php.
so 1 better performance wise?
if goal count rows, use count(*)
. num_rows
ordinarily (in experience) used confirm more 0 rows returned , continue on in case. take mysql longer read out many selected rows compared aggregation on count
if query takes same amount of time.
Comments
Post a Comment