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.<
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.
mysql_num_rows
SELECT primary FROM table WHERE fk = 1 => 0.6 seconds
But depends on what server-side language you are using