How to speed up select count(*)
with group by
?
It\'s too slow and is used very frequently.
I have a big trouble using select count(*)
test count(myprimaryindexcolumn) and compare performance to your count(*)
I would suggest to archive data unless there is any specific reason to keep it in the database or you could partition the data and run queries separately.
If you what the size of the whole table, you should query the meta tables or info schema (that exist on every DBMS I know, but I'm not sure about MySQL). If your query is selective, you have to make sure there is an index for it.
AFAIK there is nothing more you can do.