How do you understand ref in MySQL?

The usage of

explain says that ref shows which column or constant to use with key to select rows from the table.
this sentence is not understood.

Note: this ref is not the ref in type.

Mar.12,2021

recently I have also been looking at explain
. I think the ref column indicates which fields in the table have gone to the index (if the index is a primary key or a unique index, it will show that const), finally selected the data (select row, row data)


https://dev.mysql.com/doc/ref.

The ref column shows which columns or constants are compared to the index named in the key column to select rows from the table.
The

key column is the actual index used. However, index may be based on several columns of the data table. The ref column lists which columns or constants are used.

Menu