?????????sql?????????????????
???????????? ???????[ 2013/6/9 13:43:13 ] ????????
????????????????????
mysql> EXPLAIN SELECT * FROM test.`friends` WHERE fuid=’364′ and fname=’test5′;
+—-+————-+———+——+—————+————+———+————-+——+————-+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+—-+————-+———+——+—————+————+———+————-+——+————-+
| 1 | SIMPLE | friends | ref | fuid_fname | fuid_fname | 112 | const??const | 2 | Using where
+—-+————-+———+——+—————+————+———+————-+——+————-+
????Sql????????SELECT * FROM test.`friends` WHEREfname=’test5′ and fuid=’364′;???????????????Ч?????????ELECT * FROM test.`friends` WHERE fuid=’364′ and fname=’test5′????????????;
mysql> EXPLAIN SELECT * FROM test.`friends` WHERE fname=’test5′ and fuid=’364′;
+—-+————-+———+——+—————+————+———+————-+——+————-+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+—-+————-+———+——+—————+————+———+————-+——+————-+
| 1 | SIMPLE | friends | ref | fuid_fname | fuid_fname | 112 | const??const | 2 | Using where
+—-+————-+———+——+—————+————+———+————-+——+————-+
????6???????????????????????????????????????????????????????????????Ч??????????????????????ε????????????
????????????????????explain
????????????????????о????????Щ??????????????????????????????????Ч???????sql??????????????Щsql????е?????????Э?????????????????????????????explain??
????explain?????mysql????????????????select????????????????????????????????д??????????????
??????÷???????select????????explain???????
mysql> explain select * from test.index_test where time1=’20130517100552′;
+—-+————-+————+——+—————+——-+———+——-+——+————-+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+—-+————-+————+——+—————+——-+———+——-+——+————-+
| 1 | SIMPLE | index_test | ref | time1 | time1 | 253 | const | 1 | Using where |
+—-+————-+————+——+—————+——-+———+——-+——+————-+
????EXPLAIN?е?????
????id??SELECT??????????SELECT???????к?????????????????????id????1??????Mysql????id???С????????query????id?????????£???????????С?
????table?????????е?????????????????
????type????????????У?????????????????????
????Explain??type???????????????????????????????????????????????
????system>const>eq_ref> ref > range > index > ALL
????possible_keys??????????????????е???????????????????п??????????????????????WHERE???????????????????
????key???????????????????NULL?????????????????????????£?MYSQL???????????????????????????£???????SELECT????????USE INDEX??indexname???????????????????????IGNORE INDEX??indexname???????MYSQL??????????
????key_len????????????????????????????????£??????????á?
????ref???????????????б?????????????????????????????
????rows??MYSQL?????????????????????????????????
????Extra??????MYSQL??ν????????????????
????Extra?з????????
????Distinct?????MYSQL????????????????????У???????????
????Not exists??MYSQL?????LEFT JOIN???????????????LEFT JOIN??????У???????????
????Range checked for each Record??index map:#??:????????????????????????????????????????????MYSQL???????????????????????????з????С????????????????????????
????Using filesort????????????????????п????????????MYSQL??????ж???????????????ζ?????????????????????????????洢?????????????????????е?????????????????
????Using index????????????????????????е????????ж???????ж????????????????????????????ж????????????????????
????Using temporary ????????????????????????????MYSQL??????????????????洢??????????????????????м?????ORDER BY?????????GROUP BY??
????Using where???????WHERE???????????Щ?н?????????????????????????????????????е?????У?????????????ALL??index?????????????????????????????????????
??????
???·???
??????????????????
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