[DB152](root@localhost) [cm]> SELECT COUNT(*) FROM handledata_tree_key_value_20131209;
+----------+
| COUNT(*) |
+----------+
| 3627370 |
+----------+
1 ROW IN SET (2 MIN 41.21 sec)
[DB152](root@localhost) [cm]> SHOW TABLE STATUS LIKE '%handledata_tree_key_value_20131209%' \G
*************************** 1. ROW ***************************
,, Name: handledata_tree_key_value_20131209
, Engine: InnoDB
, Version: 10
,Row_format: Compact
,, ROWS: 11678050
Avg_row_length: 279
Data_length: 3262119936
Max_data_length: 0
Index_length: 334495744
, Data_free: 4194304
AUTO_INCREMENT: 3669961
Create_time: 2013-12-10 09:56:33
Update_time: NULL
,Check_time: NULL
, Collation: utf8_general_ci
, Checksum: NULL
Create_options:
, Comment:
1 ROW IN SET (0.00 sec)
[DB152](root@localhost) [cm]> SELECT version();
+------------+
| version() |
+------------+
| 5.6.13-log |
+------------+
1 ROW IN SET (0.01 sec)
CREATE TABLE `handledata_tree_key_value_20131209` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`k` VARCHAR(255) NOT NULL DEFAULT '',
`v` mediumtext NOT NULL,
PRIMARY KEY (`id`),
KEY `k` (`k`)
) ENGINE=InnoDB AUTO_INCREMENT=3669961 DEFAULT CHARSET=utf8
此表實際有數據3,627,370條, show table status 卻抽樣統計出來了11,678,050條記錄。
這個表的結構非常簡單,只有三個字段, 主鍵id , k ,v , 但是v記錄的長度卻浮動比較大,從0到16,777,215字節不等。
導致每個page中的記錄條數相差非常大,抽樣統計的話,就難以保證准確度了。
不過,統計出來的Rows比Auto_increment還要大,應該算是bug吧,至少應該給個warning…