Index usage - SQL hints, covering indexes, back-to-table queries

1. SQL prompt

use index is to give MySQL a hint to use the index as much as possible during execution. As for whether MySQL will accept the suggestion in the end, it is not certain.

ignore index is that mysql ignores an index.

force index forces mysql to use the index. mysql has no choice.
insert image description here

2. Covering index

Covering index and back-to-table query are two relative concepts. Let’s talk about back-to-table query first.

Back to the table: refers to go to the secondary index to search first, get the query result, get an id, and then load the data of this row in the clustered index according to the id. This process is called back-to-table.
insert image description here

insert image description here
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/weixin_44860226/article/details/131819614