Stembridge, Michael wrote:
I noticed another listmember used COUNT(fieldname) instead of COUNT(*).

Is there a noticeable performance increase with COUNTing a column name
instead of all columns?   (ie, like SELECTing specific columns instead of
using SELECT *)

If anything, I'd expect the reverse, and the query result may be different, depending on your data. COUNT(*) returns the number of rows matching the WHERE clause, while COUNT(column_name) returns the number of matching rows where column_name is not NULL (so MySQL has to do more to calculate it).


Note also that COUNT(*) without a WHERE clause is optimized with MyISAM tables to return the number of rows in the table very quickly. The same would not be true of COUNT(column_name).

--
Keith Ivey <[EMAIL PROTECTED]>
Smokefree DC
http://www.smokefreedc.org
Washington, DC

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



Reply via email to