在這裏,我正在按下並在我的筆記本上的開發數據庫上運行相同的命令,一遍又一遍;當我查詢模式時,MySQL會給出波動的行數?
mysql> select count(*) from tblTraceOutput;
+----------+
| count(*) |
+----------+
| 300175 |
+----------+
1 row in set (0.42 sec)
mysql> select count(*) from tblTraceOutput;
+----------+
| count(*) |
+----------+
| 300175 |
+----------+
1 row in set (0.35 sec)
mysql> select count(*) from tblTraceOutput;
+----------+
| count(*) |
+----------+
| 300175 |
+----------+
1 row in set (0.45 sec)
這裏我是這樣做的,按'up'並再次運行最後一個命令,但輸出是chaning。這裏發生了什麼?沒有什麼是使用這個數據庫,因爲它是我本地筆記本電腦上的副本,供我自己修改。表tblTraceOutput
爲什麼表格行數發生變化?
mysql> SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'smoketrace';
+----------------+------------+
| table_name | table_rows |
+----------------+------------+
| tblCategories | 9 |
| tblResults | 32463 |
| tblRoutes | 300 |
| tblSettings | 2 |
| tblTraceOutput | 303463 |
| tblTraces | 12 |
+----------------+------------+
6 rows in set (0.01 sec)
mysql> SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'smoketrace';
+----------------+------------+
| table_name | table_rows |
+----------------+------------+
| tblCategories | 9 |
| tblResults | 32948 |
| tblRoutes | 246 |
| tblSettings | 2 |
| tblTraceOutput | 297319 |
| tblTraces | 12 |
+----------------+------------+
6 rows in set (0.00 sec)
mysql> SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'smoketrace';
+----------------+------------+
| table_name | table_rows |
+----------------+------------+
| tblCategories | 9 |
| tblResults | 32948 |
| tblRoutes | 451 |
| tblSettings | 2 |
| tblTraceOutput | 302127 |
| tblTraces | 12 |
+----------------+------------+
6 rows in set (0.02 sec)
刷新頁面,當我看到在phpMyAdmin這種行爲,所以我想檢查自己的CLI,正如你所看到的,它確實正在發生變化!
mysql --version
./bin/mysql Ver 14.14 Distrib 5.5.8, for Linux (i686) using EditLine wrapper
free -m
total used free shared buffers cached
Mem: 1880 1830 49 0 51 600
-/+ buffers/cache: 1179 701
Swap: 1027 0 1026
uname -a
Linux laptop 3.4.11 #1 SMP Sun Sep 23 15:03:21 BST 2012 i686 i686 i386 GNU/Linux
別的東西戳在桌子上?不要忘記,在innodb表中,某些行將被事務隱藏,但仍然需要在內部進行計數 – 2013-04-03 19:48:40
如果這是您的意思,那麼沒有什麼數據庫正在使用。自從我導入數據以來,它只有15分鐘,但它是<40MBs,我想知道它是否仍然是索引或類似的,但我的CPU是1%〜2%使用 – jwbensley 2013-04-03 19:49:53