MySQL gives fluctuating row count when I query schema?

后端 未结 4 2080
春和景丽
春和景丽 2020-12-06 04:36

Here I am pressing up and running the same command on my dev DB on my laptop, over and over;

mysql> select count(*) from tblTraceOutput;
+----------+
| co         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 05:12

    It seems you are using an InnoDB table. They only hold a very rough estimate of row numbers in the status table meant to help the MySQL optimizer have basis for the query plan choices. For an exact row count you should keep a separate counter if needed frequently (as select count(*) is far from efficient).

提交回复
热议问题