gpt4 book ai didi

MySQL 错误? "SHOW TABLE STATUS"报告导入期间行数波动

转载 作者:行者123 更新时间:2023-11-29 01:25:24 27 4
gpt4 key购买 nike

我正在将 410 万条记录导入到离线系统中,以便对数据库的子集进行一些分析。当我运行导入时,我尝试使用以下方法检查其进度:

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 etch 发行版


编辑:

这是 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

最佳答案

关于行数

Some storage engines, such as MyISAM, store the exact count. For other storage engines, such as InnoDB, this value is an approximation, and may vary from the actual value by as much as 40 to 50%.

取自 MySQL :: MySQL 5.1 Reference Manual - SHOW TABLE STATUS Syntax

关于MySQL 错误? "SHOW TABLE STATUS"报告导入期间行数波动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2193794/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com