Is there a quicker query of counting how many rows there are using a WHERE statement?
The current query I use in PHP is:
$result = mysql_query("SELECT SQL_NO_CACHE id FROM users WHERE user = '$tnuser'");
$total = mysql_num_rows($result);
The table engine is InnoDB and ID is primary key and user is indexed. This query is ran 300+ a second so any performance gain would be good. The total count is always changing and users are deleted/added very often.
Thank you
Usually its faster to use the aggregate functions of SQL to count something. You could for example try