-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Simetrical wrote:
On Fri, Jun 20, 2008 at 2:46 PM, demon@svn.wikimedia.org wrote:
No need to count(*) in SiteStats::admins ...
self::$admins = $dbr->selectField( 'user_groups', 'COUNT(*)', array( 'ug_group' => 'sysop' ), __METHOD__ );
self::$admins = $dbr->selectField( 'user_groups', 'COUNT(ug_group)', array( 'ug_group' => 'sysop' ), __METHOD__ );
What is this intended to do? ug_group is NOT NULL; COUNT(ug_group) will always be identical to COUNT(*).
There is an urban legend that count(field) is faster than count(*), since it doesn't have to load all those fields specified by the '*'. I'm pretty sure it's not actually true, though, and that the database knows that '*' just means "count the rows" here. :)
- -- brion