Using count(*) vs num_rows

后端 未结 5 2570
灰色年华
灰色年华 2021-02-20 10:20

To get number of rows in result set there are two ways:

  1. Is to use query to get count

    $query=\"Select count(*) as count from some_table where type=

5条回答
  •  暖寄归人
    2021-02-20 10:52

    num_rows() would be better if you have small quantity of rows and count(*) will give you performance if there are large number of rows and you have to select one and send it to php.

提交回复
热议问题