我将4.1mil记录导入离线系统,对我们数据库的一个子集进行一些分析。当我正在运行导入时,我正在尝试使用以下方法检查其进度:
SHOW TABLE STATUS LIKE 'MailIssueElement'
奇怪的是......在不同的时间,我看到Rows
的值更高和更低。我希望它只会上升。以下是输出示例:
mysql> show table status like 'MailIssueElement' \G
*************************** 1. row ***************************
Name: MailIssueElement
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 2818307
Avg_row_length: 120
Data_length: 338392232
Max_data_length: 281474976710655
Index_length: 158029824
Data_free: 0
Auto_increment: 10248973
Create_time: 2010-02-03 10:58:41
Update_time: 2010-02-03 11:04:06
Check_time: 2010-02-03 10:58:53
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.60 sec)
mysql> show table status like 'MailIssueElement' \G
*************************** 1. row ***************************
Name: MailIssueElement
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 1870294
Avg_row_length: 119
Data_length: 223251912
Max_data_length: 281474976710655
Index_length: 107688960
Data_free: 0
Auto_increment: 10248973
Create_time: 2010-02-03 10:58:41
Update_time: 2010-02-03 11:04:13
Check_time: 2010-02-03 10:58:53
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.35 sec)
mysql> show table status like 'MailIssueElement' \G
*************************** 1. row ***************************
Name: MailIssueElement
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 3074205
Avg_row_length: 120
Data_length: 369507112
Max_data_length: 281474976710655
Index_length: 171537408
Data_free: 0
Auto_increment: 10248973
Create_time: 2010-02-03 10:58:41
Update_time: 2010-02-03 11:04:36
Check_time: 2010-02-03 10:58:53
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.01 sec)
mysql> show table status like 'MailIssueElement' \G
*************************** 1. row ***************************
Name: MailIssueElement
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 1870294
Avg_row_length: 119
Data_length: 223251912
Max_data_length: 281474976710655
Index_length: 107688960
Data_free: 0
Auto_increment: 10248973
Create_time: 2010-02-03 10:58:41
Update_time: 2010-02-03 11:04:40
Check_time: 2010-02-03 10:58:53
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.00 sec)
这种行为有解释吗?有没有更好的方法来检查我的导入进度?
运行以下版本:服务器版本:5.0.32-Debian_7etch11-log Debian蚀刻分布
修改
这是DDL。这是一张MyISAM表:
mysql> show create table MailIssueElement \G
*************************** 1. row ***************************
Table: MailIssueElement
Create Table: CREATE TABLE `MailIssueElement` (
`Id` int(11) NOT NULL auto_increment,
`IssueId` int(11) NOT NULL default '0',
`Date` datetime NOT NULL default '0000-00-00 00:00:00',
`Direction` enum('inbound','outbound') NOT NULL default 'inbound',
`ToAddr` varchar(255) NOT NULL default '',
`FromAddr` varchar(255) NOT NULL default '',
`CCAddrs` varchar(255) NOT NULL default '',
`Subject` text NOT NULL,
`ParentIssueElementId` int(11) default NULL,
`ParentIssueElementType` enum('mail','phone') default 'mail',
`AgentId` int(11) NOT NULL default '0',
PRIMARY KEY (`Id`),
KEY `date_idx` (`Date`),
KEY `IssueId` (`IssueId`),
KEY `idx_agent_id` (`AgentId`)
) ENGINE=MyISAM AUTO_INCREMENT=15099881 DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
提前致谢,
-AJ
答案 0 :(得分:3)
关于行数
某些存储引擎(如MyISAM)会存储确切的计数。对于其他存储引擎,例如InnoDB,此值是近似值,并且可能与实际值相差多达40%到50%。
取自MySQL :: MySQL 5.1 Reference Manual - SHOW TABLE STATUS Syntax
答案 1 :(得分:2)
该表必须是InnoDB。
来自SHOW STATUS Doc
<强>行强>
行数。某些存储引擎(如MyISAM)会存储确切的计数。对于其他存储引擎,例如InnoDB,此值是近似值,并且可能与实际值相差多达40%到50%。在这种情况下,请使用SELECT COUNT(*)来获得准确的计数。
答案 2 :(得分:1)
好的,看起来好像是a bug reported and fixed。猜猜我需要最终从Etch升级到Lenny并获得那些更新的包...感谢您尝试所有。
答案 3 :(得分:0)
如果你使用InnoDB,Rows似乎是通过将“Data_length”除以“Avg_row_length”(波动很大)来计算的。