CREATE TABLE `antest` (
`i` int(10) unsigned NOT NULL,
`c` char(80) default NULL,
KEY `i` (`i`),
KEY `c` (`c`,`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
mysql> select count(distinct c) from antest;
+-------------------+
| count(distinct c) |
+-------------------+
| 101 |
+-------------------+
1 row in set (0.36 sec)
mysql> select count(distinct i) from antest;
+-------------------+
| count(distinct i) |
+-------------------+
| 101 |
+-------------------+
1 row in set (0.20 sec)
mysql> select count(distinct i,c) from antest;
+---------------------+
| count(distinct i,c) |
+---------------------+
| 10201 |
+---------------------+
1 row in set (0.43 sec)
mysql> show index from antest;
+--------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+--------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| antest | 1 | i | 1 | i | A | NULL | NULL | NULL | | BTREE | |
| antest | 1 | c | 1 | c | A | NULL | NULL | NULL | YES | BTREE | |
| antest | 1 | c | 2 | i | A | NULL | NULL | NULL | | BTREE | |
+--------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
3 rows in set (0.00 sec)
mysql> analyze table sys_users;
+--------------------------------+---------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+--------------------------------+---------+----------+----------+
| antest | analyze | status | OK |
+--------------------------------+---------+----------+----------+
1 row in set (0.01 sec)
mysql> show index from antest;
+--------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+--------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| antest | 1 | i | 1 | i | A | 101 | NULL | NULL | | BTREE | |
| antest | 1 | c | 1 | c | A | 101 | NULL | NULL | YES | BTREE | |
| antest | 1 | c | 2 | i | A | 10240 | NULL | NULL | | BTREE | |
+--------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
3 rows in set (0.01 sec)