Details
-
Type:
Bug
-
Status: Stalled
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 5.1.67, 5.2.14, 5.3.12, 10.0, 5.5
-
Component/s: Storage Engine - MyISAM
-
Environment:OpenSuSE 13.1 64-bit
Description
Indexes missing cardinality after importing data from the dump. Specifically cardinality is not populated after indexes enabled after being disabled. Simple query to demonstrate the problem:
DROP TABLE IF EXISTS `bad_table`;
CREATE TABLE `bad_table` (
`id1` INT(10) UNSIGNED NOT NULL,
`id2` INT(10) UNSIGNED NOT NULL,
INDEX `idx1` (`id1`, `id2`)
)
ENGINE=MyISAM;
/*!40000 ALTER TABLE `jobListDevices` DISABLE KEYS */;
INSERT INTO `bad_table` VALUES
(1,1),
(1,2),
(1,3),
(1,4),
(2,1),
(2,2),
(2,3),
(2,4),
(3,1),
(3,2),
(3,3),
(3,4)
;
/*!40000 ALTER TABLE `jobListDevices` ENABLE KEYS */;
show index from `bad_table`;
analyze table `bad_table`;
show index from `bad_table`;
Gliffy Diagrams
Attachments
Issue Links
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
For me cardinality is populated.
With your test case (with the different table name in ALTER TABLE statements) it happens after analyze table:
If I fix the table name, it happens upon ALTER .. ENABLE KEYS:
MariaDB [test]> ALTER TABLE `bad_table` ENABLE KEYS; Query OK, 0 rows affected (0.00 sec) MariaDB [test]> show index from `bad_table`; +-----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | +-----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | bad_table | 1 | idx1 | 1 | id1 | A | 3 | NULL | NULL | | BTREE | | | | bad_table | 1 | idx1 | 2 | id2 | A | 12 | NULL | NULL | | BTREE | | | +-----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ 2 rows in set (0.00 sec)Please provide the output of your last show index and your cnf file(s) our output of show variables. Thanks.