Actually, I'm seeing that MySQL uses any index available to do count([asterisk]), even if there isn't a where clause. For example, I just ran the following queries on a WordPress database:
[1] select count(object_id) from wp_term_relationships force index(PRIMARY);
[2] select count([asterisk]) from wp_term_relationships
[3] select count([asterisk]) from wp_posts
... all of which produce execution plans that show indexes are being used to perform the count() query. All tables are using InnoDB.
Off topic question: how do you escape an asterisk when entering a reply so that it shows w/in the thread vs. italicizing text?
[1] select count(object_id) from wp_term_relationships force index(PRIMARY);
[2] select count([asterisk]) from wp_term_relationships
[3] select count([asterisk]) from wp_posts
... all of which produce execution plans that show indexes are being used to perform the count() query. All tables are using InnoDB.
Off topic question: how do you escape an asterisk when entering a reply so that it shows w/in the thread vs. italicizing text?