<p>Whats the most efficient way of selecting total number of records from a large table? Currently, Im simply doing</p>

<pre><code>$result = mysql_query("SELECT id FROM table");
$total = mysql_num_rows($result)
</code></pre>

<p>I was told this was not very efficient or fast, if you have a lot of records in the table. </p>

You should use
SQL's built in COUNT function
:
```
```
$result = mysql_query("SELECT COUNT(id) FROM table");
```
```