Reputation: 6731
Why does phpMyAdmin show an empty cardinality?
If I edit the index (without change anything) and save, the cardinality will appear, but after a TRUNCATE and some INSERTs, the cardinality become empty again.
Running
ALTER TABLE tableName ENABLE KEYS
doesn't help.
How to make the cardinality always present?
Edit:
The phpMyAdmin version is 4.6.4
The MySql version is libmysql - mysqlnd 5.0.12-dev - 20150407
The Engine is MyISAM
Upvotes: 1
Views: 2765
Reputation: 142453
Aha -- I found NULLs with SHOW INDEXES
on a MyISAM table. Is yours ENGINE=MyISAM
? Recommend changing to InnoDB.
Upvotes: 0
Reputation: 48387
You need to analyze the table.
ANALYZE LOCAL TABLE tablename
The stats for the primary key are updated when the data is updated, but the other indexes need this operation to set a value. Note that if the distribution of the data is not changing then you don't need to refresh the indexes.
Note that there is a performance impact (and locking impact with MyISAM) on large tables when you run this.
Upvotes: 2