How to speed up “select count(*)” with “group by” and “where”?

后端 未结 9 564
北恋
北恋 2020-12-07 10:28

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(*)

9条回答
  •  遥遥无期
    2020-12-07 11:03

    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.

提交回复
热议问题