MySQL daje zmienną liczbę wierszy podczas kwerendy schematu?
Tutaj naciskam i uruchamiam to samo polecenie na moim dev DB na moim laptopie w kółko;
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)
Tutaj robię to samo, naciskając „w górę” i uruchamiając ponownie ostatnie polecenie, ale wyjście zmienia się. Co tu się dzieje? Nic nie korzysta z tej bazy danych, ponieważ jest to kopia na moim lokalnym laptopie dla mojego majsterkowania. Dlaczego liczba wierszy tabeli zmienia się w tabelitblTraceOutput
?
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)
Podczas odświeżania strony widziałem to zachowanie w phpMyAdmin, więc chciałem sprawdzić na CLI i jak widać, to naprawdę się zmienia!
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