Mysql count performance on very big tables

前端 未结 6 672
说谎
说谎 2020-11-30 00:29

I have a table with more than 100 millions rows in Innodb.

I have to know if there is more than 5000 rows where the foreign key = 1. I don\'t need the exact number.<

6条回答
  •  遥遥无期
    2020-11-30 01:03

    If you are using PHP you could do mysql_num_rows on the result you got from SELECT primary FROM table WHERE fk = 1 => 0.6 seconds, I think that will be efficient.

    But depends on what server-side language you are using

提交回复
热议问题