MYSQL????м??
???????????? ???????[ 2015/1/14 11:12:18 ] ??????????????? ????? MySQL
????1?? ??????
??????м????????????????sql???????????????????????mysql????м???????oracle??????????????????SQL?????????????
???????????????mysql??м????????????????
????2?? ??м??????????
????2.1 ??м?????????????explain select …………….
??????????????????????select????explain????
????2.2 ??м?????
????Id?????????????????????????select?????????????
????????????С??У?
??????id??????????????????????£?
????Select_type:???????????select???????????OR????????????????
????SIMPLE??????в?????????????UNION
????PRIMARY?????????????κθ?????????????????????PRIMARY
????SUBQUERY????SELECT??WHERE?б??а???????????????????????SUBQUERY
????DERIVED????FROM?б??а???????????????DERIVED????????
??????????SELECT??????UNION?????????UNION??
??????UNION??????FROM?????????У????SELECT??????????DERIVED
??????UNION?????????SELECT????????UNION RESULT
????Type?????MySQL?????????????е????????“????????”???????????????
????ALL??Full Table Scan?? MySQL???????????裻
????index??Full Index Scan??index??ALL?????index?????????????????
????range??range Index Scan????????????迪???????????????????У???????between??<??>???????
????ref????????????裬???????????????????????С?????????÷???????????????????е?????
????eq_ref??????????裬?????????????????????????????????????????????????????
????const??system????MySQL??????????????????????????????????????Щ?????????罫????????where?б??У?MySQL????ò?????????????
????NULL??MySQL??????????з????????????????÷?????????
????possible_keys?????MySQL?????????????????????У?????漰????????????????????????????????г???????????????????
????key?????MySQL?????????????????????????????????????NULL????????????????????????????????????????key?б???
????key_len??????????????????????????????м????????????????????
????ref?????????????????????????????Щ?л????????????????????????
????rows?????MySQL????????????????????????????????????????????????????????
????Extra??????????????????????????????????????????
????Using where?????MySQL????????洢???????????????“?????”??Post-filter??????????δ???????????Using where?????????????????MySQL????where?????????????
????Using temporary?????MySQL??????????????洢?????????????????????????
????Using filesort??MySQL???????????????????????????“???????”??
????2.3 mysql??м???????
????EXPLAIN????????????????????洢?????????????????庯??????????????
????EXPLAIN?????????Cache
????EXPLAIN???????MySQL????в????????????????
????????????????????????????
????EXPALIN??????SELECT?????????????????д?SELECT?????м??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11