Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 5.5.40
-
Fix Version/s: N/A
-
Component/s: Storage Engine - XtraDB
-
Labels:None
-
Environment:centos6-amd64
Description
idx_obs_daily_1 has 3 fields not 4.
MariaDB [weather]> select * from information_schema.INNODB_INDEX_STATS where table_schema='weather' and table_name='obs_daily'; +--------------+------------+-----------------+--------+---------------------+-------------------+------------------+ | table_schema | table_name | index_name | fields | rows_per_key | index_total_pages | index_leaf_pages | +--------------+------------+-----------------+--------+---------------------+-------------------+------------------+ | weather | obs_daily | PRIMARY | 1 | 1 | 212672 | 185818 | | weather | obs_daily | idx_obs_daily_2 | 2 | 3178, 1 | 28032 | 24434 | | weather | obs_daily | idx_obs_daily_1 | 4 | 2160489, 1271, 0, 0 | 46784 | 40750 |
| obs_daily | CREATE TABLE `obs_daily` ( `iId` int(11) NOT NULL AUTO_INCREMENT, `sLocType` varchar(10) NOT NULL DEFAULT '', `sLocCode` varchar(30) NOT NULL DEFAULT '', `dtDate` date NOT NULL DEFAULT '0000-00-00', .... PRIMARY KEY (`iId`), UNIQUE KEY `idx_obs_daily_1` (`sLocType`,`sLocCode`,`dtDate`), KEY `idx_obs_daily_2` (`dtDate`) ) ENGINE=InnoDB AUTO_INCREMENT=23562482 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC |
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Of course we know that in InnoDB, non-PK indexes also contain the value of the primary key as the last field of the index, except this is internal and hidden from the visible table structure.
So the output is, while correct in terms of what's stored, confusing.
To "unconfuse" it, the INNODB_INDEX_STATS output could just colcount-1 for any non-PK index.
Pretty simple, but I have to say I'm ambivalent about whether it's worthwhile - it's good to have this documented explicitly of course, to at least have a reference point in case of confusion