Select Count() is Different From Table Cardinality on Non Unique Indexes

(Doc ID 2351207.1)

Last updated on FEBRUARY 16, 2018

Applies to:

MySQL Server - Version 5.7 and later
Information in this document applies to any platform.


To understand the cardinality of indexes on a table and how the select count() function can show different values.


On review of an example table it can be seen that the indexes as reported by the InnoDB Storage Engine have the following cardinalities;


This appears to be over 10x difference, which can lead to some confusion if not understood.


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms