当前位置:网站首页>The explain statement in MySQL queries whether SQL is indexed, and several types in extra collate and summarize

The explain statement in MySQL queries whether SQL is indexed, and several types in extra collate and summarize

2022-06-29 20:14:00 Game programming

1.using index Find through the secondary common index , Implement overlay index , There is no need to query the table
2.using index condition Find through the secondary common index , After the results found through the index, there are where filter , And this filtering can be realized only by using the secondary ordinary index , No judgment filtering in memory . But you need to query the required field values back to the table .
3.using where Whether or not it is found through the index , As long as the data is loaded into memory where Condition screening , All are
4.using index & using where: Search uses index , But all the data needed can be found in the index column , So you don't need to go back to the table to query the data

Practical example

If there is a watch xxx, to modify_date Index
1.using index Find through the secondary common index , Implement overlay index , There is no need to query the table

explainSELECT modify_date        from xxx
mysql in explain Statement query sql Whether to follow the index ,extra Several types of sorting and summarizing in - The first 1 Zhang

2.using index condition Find through the secondary common index , We need to go back to the table

explainSELECT *        from xxx where modify_date > "2022-06-27 10:27:07" and modify_date < "2022-06-28 0:0:0"
mysql in explain Statement query sql Whether to follow the index ,extra Several types of sorting and summarizing in - The first 2 Zhang

3.using where Search without index

explainSELECT *        from xxx        where create_date > "2022-06-27 10:27:07" and create_date < "2022-06-28 0:0:0"
mysql in explain Statement query sql Whether to follow the index ,extra Several types of sorting and summarizing in - The first 3 Zhang

4.using index & using where: Search uses index , But all the data needed can be found in the index column , So you don't need to go back to the table to query the data

explainSELECT modify_date        from xxx where modify_date > "2022-06-27 10:27:07" and modify_date < "2022-06-28 0:0:0"

Return results

mysql in explain Statement query sql Whether to follow the index ,extra Several types of sorting and summarizing in - The first 4 Zhang

author :Koikoi123

Game programming , A game development favorite ~

If the picture is not displayed for a long time , Please use Chrome Kernel browser .

原网站

版权声明
本文为[Game programming]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/180/202206292005279956.html