????1??limit(???10 ??20 ??)<????????????????0>
????select * from students order by id limit 9??10;
????2??MySQL ??????????????????
????<??<=??>=??>??=??between??in??????%????_?????like
????3??????????????
????1)??????????????????
????2??????????
????3????????????????????
????????????????????м????????????????????????????????
??????????????????????????????????????
????4??????????Ч??
????????????????SQL ????????explain??
???????????????壺
????1??table????????
????2??type????????????(ALL/Range/Ref)??????ref ????????
????3??possible_keys??????????????????????
????4??key???????????????
????5??key_len???????б???ò??????????????
????6??ref??????????????”const”?????????????????
????7??rows?????MySQL ??????????????????????????????
????8??extra??MySQL ????飻
????5????y????????
????1??????????y????????????
????2???????????????????????
????a????char ????varchar??????????????????????Щ??
????b????????????????????????γ????????????????????????
???????
????c?????????????????????ù???????????е??????????1???
??????ù????????????У???????????λ?????????????????????????
???????????????????????????????в???????
????d??????MyISAM ???????????????????????????????п??????
??????????????????????
????6?????not null ??enum
???????????ж????not null?????????????????????????????
??????????????????MySQL ??????????????????????null ???????????
???????
????????????????????????????????????????Ч????????????
????????????????????????????enum ?е????MySQL ???????????????
??????enum ?????????????????????????
????7?????optimize table
???????????????????????????????????????????????????
????????飬??????????????п????????????????????????????blob
??????????????????????????仯???????????????optimize table ??
????????????????????????????????????Щ??????????????? optimize
????table ????????MyISAM ??BDB ?????????????????κ?????????????????
????mysqldump ??????????????????????????????????????
????8?????procedure analyse()
???????????procedure analyse()????????????飬??ú??????
????select ?????????procedure analyse()??????????磺
????select * from students procedure analyse();
????select * from students procedure analyse(16??256);
???????????????procedure analyse()??????麬?ж???16 ???????
????????ж???256 ????enum ????????????????????????????
????9????ò??????
????1??????????????????
???????????????select ????????????????ò??????????????
??????????洢??????У??′??????????????????????з???????????????
?????????????????κλ????????????Ч??????????????
????2??????????????
??????????query_cache _type???????????????????3 ??????0????
???????棻1???????????????? select sql_no_cache ?????2??????????????
??????Щ??select sql_cache ????????? query_cache_size?????ò???????
?????????????С?????????????????檔
????10?????????
????1?????????????????棻
????2??????????????????I/O ??????
????????????????????????????????????????????????????
??????λ????????????