0

If I run SHOW COLUMNS FROM table_name I get:

+-----------------+--------------+------+-----+---------+----------------+
| Field           | Type         | Null | Key | Default | Extra          |
+-----------------+--------------+------+-----+---------+----------------+
| convo_id        | int(11)      | NO   | PRI | NULL    | auto_increment |
| client_convo_id | varchar(255) | NO   |     | NULL    |                |
| user_id         | int(11)      | NO   | MUL | NULL    |                |
+-----------------+--------------+------+-----+---------+----------------+

Looking at the Key-column, it is clear what PRI means, namely, primary key. MUL, according to my research, stands for multiple, which means there can me multiple instances of the same user_id in this table. But what about the client_convo_id field? It has no value in the Key-column. What does this mean? I suspect that there can be multiple entries in the table with the same client_convo_id. Why, then, does client_convo_id not have MUL in its Key-column?

jarlh
  • 42,561
  • 8
  • 45
  • 63
Sahand
  • 7,980
  • 23
  • 69
  • 137

1 Answers1

3

MUL means that the field is part of a non-unique index, as answered here: Another question

There is nothing in the Key column for client_convo_id, because that field does not have an index attached to it.

Not all columns in SQL have indexes. Only one that are used for selection (in where or join clauses) are usually indexed, so the queries run faster. Here is the official documentation on the matter.

DreamWave
  • 1,934
  • 3
  • 28
  • 59