admin管理员组文章数量:1638814
i came across a strange phenomenon, and i hope, that someone can explain this to me:
i have a some "static" tables (they change once per day).
mysql> select 'appObjectGroups' as tbl, count(*) as num from appObjectGroups
union select 'appObjectDependencies' as tbl, count(*) as num from appObjectDependencies
union select 'appObjectUrls' as tbl, count(*) as num from appObjectUrls
union select 'appObjectValues' as tbl, count(*) as num from appObjectValues
union select 'appObjects;' as tbl, count(*) as num from appObjects;
+-------------------------+------+
| tbl | num |
+-------------------------+------+
| appObjectGroups | 1149 |
| appObjectDependencies | 6885 |
| appObjectUrls | 1162 |
| appObjectValues | 3795 |
| appObjects; | 5409 |
+-------------------------+------+
5 rows in set (0.00 sec)
mysql> select table_name as tbl, table_rows as num from information_schema.tables where table_schema='mySchema' and table_name like 'app%';
+-------------------------+------+
| tbl | num |
+-------------------------+------+
| appObjectGroups | 1141 |
| appObjectDependencies | 6153 |
| appObjectUrls | 1141 |
| appObjectValues | 3584 |
| appObjects | 6061 |
+-------------------------+------+
5 rows in set (0.01 sec)
so how come that table_rows report something different than count(*)?
and more important to me: which one is correct? :-)
解决方案
Quoting from documentation:
For InnoDB tables, the row count is only a rough estimate used in SQL
optimization. (This is also true if the InnoDB table is partitioned.)
本文标签: 行数mysqltablerowsinformationschema
版权声明:本文标题:mysql table_rows,MySQL的行数count(*)与information_schema中的table.table_rows不一致 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1729279359a1193879.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论