我遇到了一个奇怪的现象,我希望,有人可以向我解释这个:
我有一些"静态"桌子(每天更换一次)。
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)
那么,table_rows
如何报告与count(*)
不同的内容?
对我来说更重要:哪一个是正确的? : - )