当前位置:网站首页>[notes] like the solution to the problem of slow query (index + explicitly specifying query fields)

[notes] like the solution to the problem of slow query (index + explicitly specifying query fields)

2022-06-13 08:21:00 SDL Dahua

Preface

I feel this knowledge point is very important during the test today , And the probability of using it is quite high .

Important note :

like The double hundredth fuzzy matching of can use the index , But only if the target field has an index , also select The field name must be explicitly specified later .

//like The problem of slow query is solved ( Index required + Specify query fields explicitly )
// When there's too much data ,like It's going to be inefficient , Because it is a full table scan , No index

// Solution

1、 Add an index to the field

2、 Specify query fields explicitly

MySQL edition

mysql8.0

legend ( Specify fields explicitly ):

legend ( No field specified ):

Be careful :select Field name must be specified later , Otherwise, the index cannot be used !

END

原网站

版权声明
本文为[SDL Dahua]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202270543123460.html