Fastest way to get the record count?

2005-05-13 Thread Brian Dunning
I've been doing the following to get the record count from a db. Is  
this the fastest?

select count(id) as `count` from tablename;
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Fastest way to get the record count?

2005-05-13 Thread Eric Bergen
select count(*) from table is the fastest for myisam because it caches 
row count. This will also include any rows that have null values.

select count(col) from table will not count rows where that column is 
null and will also be forced to access the index or data file.

-Eric
Brian Dunning wrote:
I've been doing the following to get the record count from a db. Is  
this the fastest?

select count(id) as `count` from tablename;

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]