Configuring Optimizer Statistics for InnoDB +------------+--------------+------------+------------------+ | index_name | stat_name | stat_value | stat_description | +------------+--------------+------------+------------------+ | PRIMARY | n_diff_pfx01 | 1 | a | | PRIMARY | n_diff_pfx02 | 5 | a,b | | i1 | n_diff_pfx01 | 1 | c | | i1 | n_diff_pfx02 | 2 | c,d | | i1 | n_diff_pfx03 | 2 | c,d,a | | i1 | n_diff_pfx04 | 5 | c,d,a,b | | i2uniq | n_diff_pfx01 | 2 | e | | i2uniq | n_diff_pfx02 | 5 | e,f | +------------+--------------+------------+------------------+ For the  PRIMARY  index, there are two  n_diff%  rows. The number of rows is equal to the number of columns in the index. For nonunique indexes,  InnoDB  appends the columns of the primary key. For the secondary index ( i1 ), there are four  n_diff%  rows. Only two columns are defined for the secondary index ( c,d ) but there are four  n_diff%  rows for the secondary index because  InnoDB  suffixes all nonunique indexes with the primary key. As a result, there are four  n_diff%  rows instead of two to account for the both the secondary index columns ( c,d ) and the primary key columns ( a,b ). Note •Where  index_name = PRIMARY  and  stat_name = n_diff_pfx01 , the  stat_value  is  1 , which indicates that there is a single distinct value in the first column of the index (column  a ). The number of distinct values in column  a  is confirmed by viewing the data in column  a  in table  t1 , in which there is a single distinct value ( 1 ). The counted column ( a ) is shown in the  stat_description  column of the result set. •Where  index_name = PRIMARY  and  stat_name = n_diff_pfx02 , the  stat_value  is  5 , which indicates that there are five distinct values in the two columns of the index ( a,b ). The number of distinct values in columns  a  and  b  is confirmed by viewing the data in columns  a  and  b  in table  t1 , in which there are five distinct values: ( 1,1 ), ( 1,2 ), ( 1,3 ), ( 1,4 ) and ( 1,5 ). The counted columns ( a,b ) are shown in the  stat_description  column of the result set. •Where  index_name = i1  and  stat_name = n_diff_pfx01 , the  stat_value  is  1 , which indicates that there is a single distinct value in the first column of the index (column  c ). The number of distinct values in column  c  is confirmed by viewing the data in column  c  in table  t1 , in which there is a single distinct value: ( 10 ). The counted column ( c ) is shown in the  stat_description  column of the result set. •Where  index_name = i1  and  stat_name = n_diff_pfx02 , the  stat_value  is  2 , which indicates that there are two distinct values in the first two columns of the index ( c,d ). The number of distinct values in columns  c  an  d  is confirmed by viewing the data in columns  c  and  d  in table  t1 , in which there are two distinct values: ( 10,11 ) and ( 10,12 ). The counted columns ( c,d ) are shown in the stat_description  column of the result set. •Where  index_name = i1  and  stat_name = n_diff_pfx03 , the  stat_value  is  2 , which indicates that there are two distinct values in the first three columns of the index ( c,d,a ). The number of distinct values in columns  c ,  d , and  a  is confirmed by viewing the data in column  c ,  d , and  a  in table  t1 , in which there are two distinct values: ( 10,11,1 ) and ( 10,12,1 ). The counted columns ( c,d,a ) are shown in the  stat_description  column of the result set. •Where  index_name = i1  and  stat_name = n_diff_pfx04 , the  stat_value  is  5 , which indicates that there are five distinct values in the four columns of the index ( c,d,a,b ). The number of distinct values in columns  c ,  d ,  a  and  b  is confirmed by viewing the data in columns  c ,  d ,  a , and  b  in table  t1 , 3137