I first created 2 separate indexes in my table: uid and time. Then I decided to create a composite index(uid, time). But why the Cardinality of uid in a composite index(row 3) is less than the Cardinality of uid in a single index(row 1)?
mysql> show index from full_data;
+-----------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-----------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| full_data | 1 | uid | 1 | uid | A | 26394792 | NULL | NULL | YES | BTREE | | |
| full_data | 1 | time | 1 | time | A | 6934463 | NULL | NULL | YES | BTREE | | |
| full_data | 1 | composite | 1 | uid | A | 23166632 | NULL | NULL | YES | BTREE | | |
| full_data | 1 | composite | 2 | time | A | 86380688 | NULL | NULL | YES | BTREE | | |
+-----------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
4 rows in set (0.05 sec)