Reputation: 1060
I am trying to learn mySQL database, and have started taking a look at the database behind wordpress. I am using the Wordpress Data Base Descrition to review the structure and I came upon the following:
|Table: wp_commentmeta|
---------------------------------------------------------------------------------
|Field |Type |Null |Key |Default | Extra
|-----------|--------------------|------|----|--------|--------------------------
|meta_id |bigint(20) unsigned | |PRI |NULL |auto_increment
|comment_id |bigint(20) unsigned | |IND |0 |FK->wp_comments.comment_id
|meta_key |varchar(255) |YES |IND |NULL |
|meta_value |longtext |YES | |NULL |
|Indexes|
---------------------------------------------------------
|Keyname |Type |Cardinality |Field
|------------|---------|------------|--------------------
|PRIMARY |PRIMARY |0 |meta_ID
|comment_id |INDEX |none |comment_id
|meta_key |INDEX |none |meta_key
My question is, what does a Cardinality value of 0 indicate in the table above. I understand the explanation of cardinality as explained in this SO answer in that it is the number of unique values within a particular set of indexed values, but I dont get what setting a value of 0 does in this particular case.
Upvotes: 0
Views: 6039
Reputation: 24025
From Mysql
Cardinality
An estimate of the number of unique values in the index. This is updated by running ANALYZE TABLE or myisamchk -a. Cardinality is counted based on statistics stored as integers, so the value is not necessarily exact even for small tables. The higher the cardinality, the greater the chance that MySQL uses the index when doing joins
So, it's just an estimate of the number of unique values in an index and isn't necessarily exact. It really just means, you probably have no chance of mysql using an index, probably because you have no data for Mysql to index on.
Taken from that Wordpress link:
The following are the specific fields in each of the tables created during the standard WordPress installation.
There is no data in this table on install, so there is nothing for MySql to index upon.
Upvotes: 0
Reputation: 111
Is your table empty? I think this just says that you have 0 rows in your table. In other words, it's not a "setting", it's just a count of how many nodes you have in your index.
Upvotes: 1