[MDEV-25351] SHOW INDEX cardinality and COUNT(DISTINCT primary key) differ Created: 2021-04-06  Updated: 2023-06-26  Resolved: 2023-06-26

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.2.27
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Rob Schwyzer Assignee: Sergei Petrunia
Resolution: Incomplete Votes: 0
Labels: None
Environment:

CentOS



 Description   

User has a table with of type ENGINE=InnoDB DEFAULT CHARSET=utf8 with a primary key defined as char(32) NOT NULL DEFAULT '',.

When using SELECT COUNT(DISTINCT primarykey, the user gets 92259134. However, SHOW INDEX's cardinality returns 6853710. This occurs regardless of whether innodb_stats_auto_recalc is on or off and persists through ANALYZE TABLE ... PERSISTENT FOR ALL.

Will this pose problems for the optimizer? Is there a way to address this if it will?


Generated at Thu Feb 08 09:37:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.