My Oracle Support Banner

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

Last updated on MARCH 18, 2019

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.


To view full details, sign in with your My Oracle Support account.

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

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.