tags:

views:

369

answers:

3

Hi all,

I'm importing 4.1mil records into an offline system to do some analysis on a subset of our database. As I'm running the import, I'm trying to check its progress by using:

SHOW TABLE STATUS LIKE 'MailIssueElement'

What's odd...at different times, I'm seeing higher AND lower values for Rows. I would expect it to only go up. Here is a sample of the output:

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)

Is there an explanation for this behavior? Is there a better way to check the progress of my import?

Running the following version: Server version: 5.0.32-Debian_7etch11-log Debian etch distribution


EDIT:

Here is the DDL. It is a MyISAM table:

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)

Thanks in advance,

-aj

+1  A: 

In regards to the number of rows

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%.

Taken from MySQL :: MySQL 5.1 Reference Manual - SHOW TABLE STATUS Syntax

Anthony Forloney
@Anthony - see my edit. It is in fact a MyISAM table. This seems contradictory to the information you provided, no? Or am I misreading it?
AJ
Oops, I did not see your edit.
Anthony Forloney
@Anthony no worries...it was *after* your answer ;) Thanks for the help.
AJ
+1  A: 

The table must be InnoDB.

From SHOW STATUS Doc

Rows

The number of rows. 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%. In such cases, use SELECT COUNT(*) to obtain an accurate count.

Yada
@Yada - see my edit. It is in fact a MyISAM table. This seems contradictory to the information you provided, no? Or am I misreading it?
AJ
A: 

OK, it looks like it was a bug reported and fixed. Guess I need to finally upgrade from Etch to Lenny and get those newer packages...thanks for trying all.

AJ