For the column and index data required by the algorithm
described above, query the
mysql.innodb_index_stats persistent index
statistics table for table t. The
n_diff_pfx% statistics show the columns that
are counted for each index. For example, columns
a and b are counted for
the primary key index. For the non-unique indexes, the primary
key columns (a,b) are counted in addition to the user defined
columns.

Based on the index statistics data shown above and the table
definition, the following values can be determined:

n_cols_in_uniq_i, the total number of all
columns in all unique indexes not counting the primary key
columns, is 2 (c and
d)

n_cols_in_non_uniq_i, the total number of
all columns in all non-unique indexes, is 4
(e, f,
g and h)

n_cols_in_pk, the number of columns in
the primary key, is 2 (a and
b)

n_non_uniq_i, the number of non-unique
indexes in the table, is 2 (i2nonuniq and
i3nonuniq))

n_part, the number of partitions, is 1.

You can now calculate
innodb_stats_persistent_sample_pages * (2 + 4
+ 2 * (1 + 2)) * 1 to determine the number of leaf pages that
are scanned. With
innodb_stats_persistent_sample_pages set to
the default value of 20, and with a default
page size of 16 KiB
(innodb_page_size=16384), you
can then estimate that 20 * 12 * 16384 bytes
are read for table t, or about 4
MiB.

Note

All 4 MiB may not be read from disk, as
some leaf pages may already be cached in the buffer pool.