Faster way to know the tolal number of rows in Mysql Database?

Posted by Starx on Stack Overflow See other posts from Stack Overflow or by Starx
Published on 2010-05-26T16:56:20Z Indexed on 2010/05/26 17:01 UTC
Read the original article Hit count: 210

Filed under:
|
|

If I need to know the total number of rows in a table of database I do something like

$query = "SELECT * FROM tablename WHERE link='1';";
$result = mysql_query($query);
$rows = mysql_fetch_array($result);
$count = count($rows);

So you see the total number of data is recovered scanning through entire database

Is there a better way

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql