content_image/767608.jpg content_image/767617.jpg
<img src='content_image/767608.jpg'>

The stat_name  column shows the following types of statistics: 

• size : Where stat_name = size , the stat_value  column displays the total number of pages in the index. 

• n_leaf_pages : Where stat_name = n_leaf_pages , the stat_value  column displays the number of leaf pages in the index. 

• n_diff_pfx NN : Where stat_name = n_diff_pfx01 , the stat_value  column displays the number of distinct values in the first column of the index. Where stat_name = n_diff_pfx02 , the stat_value column displays the number of distinct values in the first two columns of the index, and so on. Where stat_name = n_diff_pfx NN , the stat_description  column shows a comma separated list of the index columns that are counted. 

To further illustrate the n_diff_pfx NN  statistic, which provides cardinality data, consider once again the t1  table example that was introduced previously. As shown below, the t1  table is created with a primary index (columns a , b ), a secondary index (columns c , d ), and a unique index (columns e , f ): 

CREATE TABLE t1 ( a INT, b INT, c INT, d INT, e INT, f INT, PRIMARY KEY (a, b), KEY i1 (c, d), UNIQUE KEY i2uniq (e, f) ) ENGINE=INNODB; 

After inserting five rows of sample data, table t1  appears as follows: 

<img src='content_image/767617.jpg'>

When you query the index_name , stat_name , stat_value , and stat_description , where stat_name LIKE ’n_diff%’ , the following result set is returned: 

mysql> SELECT index_name, stat_name, stat_value, stat_description FROM mysql.innodb_index_stats WHERE table_name like ’t1’ AND stat_name LIKE ’n_diff%’; 

