What is the point of get_comment_count() if you cannot limit by a comment type?

That query is run in the get_comment_count() function in core. The wp_count_comments() function runs a similar query, but it caches the resulting data using the wp_cache system (so it won’t run that code more than once per request). get_comment_count() does not use the cache.

Thing is, this seems to me to be a perfectly a valid query. It runs that in order to get the count of moderated, approved, trashed, and so forth comments.

Now, the comment_approved is an indexed key in that table, so realistically, the query should be quite fast. When I run an EXPLAIN on that query, MySQL tells me that it’s a SIMPLE select with “Using index” on the comment_approved_date_gmt key.

So, it’s not a slow query by any means, and the comment type shouldn’t really make any difference. If it’s slow for you, then perhaps something is wrong with your comments table. Are the indexes properly made? Try running an OPTIMIZE on the table. Although, since that query should only really hit the index and not necessarily the table, I wouldn’t think that would matter.

Speed of a query isn’t a matter of the number of records you’re querying against, it’s a matter of indexing and how much of the table needs to be accessed to produce the result.

In case of doubt on a query, always manually run it through EXPLAIN to see what the problem actually is. Like so:

EXPLAIN SELECT comment_approved, COUNT(*) AS total
FROM wp_comments
GROUP BY comment_approved

Additional: Note that the comment_type field is NOT indexed, so adding a WHERE clause with that field would probably make the query much slower. This may be a valid concern, but the concern would be with the table indexing, not with the query.