I have the following table - stat
+----------+--------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| username | varchar(20) | NO | PRI | | |
| page | varchar(255) | NO | PRI | | |
| time | timestamp | NO | | 0000-00-00 00:00:00 | |
+----------+--------------+------+-----+---------------------+----------------+
all 3 primary keys are shown as index when I do the (show index query)
However, when I run the following explain statement:
mysql> explain select * from stat where username = "milly";
+----+-------------+-------+------+---------------+------+---------+------+-------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+-------+-------------+
| 1 | SIMPLE | stat | ALL | NULL | NULL | NULL | NULL | 13196 | Using where |
+----+-------------+-------+------+---------------+------+---------+------+-------+-------------+
The username should be indexed, so how come it doesn't show type, key and row correctly?
any reason? i am confused.
thx
+----------+--------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| username | varchar(20) | NO | PRI | | |
| page | varchar(255) | NO | PRI | | |
| time | timestamp | NO | | 0000-00-00 00:00:00 | |
+----------+--------------+------+-----+---------------------+----------------+
all 3 primary keys are shown as index when I do the (show index query)
However, when I run the following explain statement:
mysql> explain select * from stat where username = "milly";
+----+-------------+-------+------+---------------+------+---------+------+-------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+-------+-------------+
| 1 | SIMPLE | stat | ALL | NULL | NULL | NULL | NULL | 13196 | Using where |
+----+-------------+-------+------+---------------+------+---------+------+-------+-------------+
The username should be indexed, so how come it doesn't show type, key and row correctly?
any reason? i am confused.
thx