Bug #70339 mysqlindexcheck not displaying best/worst report for tables with no data
Submitted: 13 Sep 2013 17:03 Modified: 5 Dec 2013 23:05
Reporter: Sheeri Cabral (Candidate Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Utilities Severity:S3 (Non-critical)
Version:1.3.4 (workbench 5.2.47), 1.3.5 OS:Linux
Assigned to: CPU Architecture:Any

[13 Sep 2013 17:03] Sheeri Cabral
Description:
If a table has no or very little data, mysqlindexcheck does not show a report at all. 

How to repeat:
CREATE TABLE `index_test` (
  `num` mediumint(9) NOT NULL,
  `string` varchar(64) NOT NULL,
  PRIMARY KEY (`num`),
  KEY `string` (`string`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

[~]# mysqlindexcheck  --server=root:PASSWORD@localhost:/var/lib/mysql/mysql.sock test.index_test --stats --format vertical  --best 5 
# Source on localhost: ... connected.
[~]# 

INSERT INTO index_test (num,string) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'a');

[~]# mysqlindexcheck  --server=root:PASSWORD@localhost:/var/lib/mysql/mysql.sock test.index_test --stats --format vertical  --best 5 
# Source on localhost: ... connected.
[~]# 

INSERT INTO index_test (num,string) SELECT num+4,string from index_test;
(still no result from mysqlindexcheck)

INSERT INTO index_test (num,string) SELECT num+8,string from index_test;
[~]# mysqlindexcheck  --server=root:PASSWORD@localhost:/var/lib/mysql/mysql.sock test.index_test --stats --format vertical  --best 5 
# Source on localhost: ... connected.
#
# Showing the top 5 best performing indexes from test.index_test:
#
*************************       1. row *************************
    database: test
       table: index_test
        name: string
      column: string
    sequence: 1
 num columns: 1
 cardinality: 8
   est. rows: 16
     percent: 50.00
1 row.

Suggested fix:
Give some kind of output, like "not enough data to report on indexes". Otherwise we have no idea why there's no output, which could be that the table has no indexes and thus no report can be made, or a bug in mysqlindex.
[13 Sep 2013 19:10] MySQL Verification Team
Hello Sheeri,

Thank you for the report.
Verified as described.

Thanks,
Umesh
[5 Dec 2013 23:05] Philip Olson
Fixed as of the upcoming MySQL Utilities 1.3.6 / 1.4.1 releases, and here's the changelog entry:

The "mysqlindexcheck" utility now informs the user when there was not
enough data collected to produce a list of "best" and "worst" queries,
when before it would seemingly ignore the table.

Thank you for the bug report.