??????????????????????
?????????ss_si_id ?????β?????????????????? ?????????????????????????Cardinality ???y???? PRIMARY ????????????????????? ?????????????????? ????????????????????????????????
????xiean@localhost:js_sku 03:27:47>analyze table js_sgoods_sku;
????+----------------------+---------+----------+----------+
????| Table | Op | Msg_type | Msg_text |
????+----------------------+---------+----------+----------+
????| js_sku.js_sgoods_sku | analyze | status | OK |
????+----------------------+---------+----------+----------+
????but ????????β? ??Щ??????????????
xiean@localhost:js_sku 03:28:14>show index from js_sgoods_sku;
+---------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+---------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| js_sgoods_sku | 0 | PRIMARY | 1 | ss_id      | A | 18621349 | NULL | NULL | | BTREE | | |
| js_sgoods_sku | 1 | ss_si_id | 1 | ss_si_id    | A | 1551779  | NULL | NULL | | BTREE | | |
| js_sgoods_sku | 1 | ss_si_id | 2 | ss_av_zid | A | 6207116   | NULL | NULL | | BTREE | | |
| js_sgoods_sku | 1 | ss_si_id | 3 | ss_av_fid | A | 18621349 | NULL | NULL | | BTREE | | |
| js_sgoods_sku | 1 | IDX_001 | 1 | ss_sa_id | A | 3724269   | NULL | NULL | | BTREE | | |
+---------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
?????????????? ss_si_id ?????????Cardinality?? ???????????????2????????????????????????????????????????????????????????????????????????????????????????????仯??
?????e??????????????????????? ??????????Ч????????????????????????
????+--------------++----------++------------------+
????| ss_si_id=0; || count(*) || 7994788/19048617 |
????+--------------++----------++------------------+
????| 7994788     || 19048617 ||    0.4197           |
????+--------------++----------++------------------+
??????????????????????????????????????? ?????д????? ss_si_id??0 ???????????????????????? 41% ??????
?????e??????????????????????????????????????SQL?????1?????
????????????????ó????????????????Щ?????????? goods_service ???????????????????£?
????1. cpu ??????? ??
????2. jstatck pid ???dump ?????????????????dump ??F
????3. dump ?????????????????????????????????? ?????? BLOCKED ??
????4. ???jstat ??gcutil ???? FGC ???????10s????FGC???
????5. ?????ó????????????
??????????????????????????? ?????????????????700w?????????????goods_service ??汩??????????????????????????????
????OK???????????????????????????ν?????????????
???????????????????????? ss_si_id??0 ???μ????????????ε????SQL????????????ε???????ж????
????1. ???????????ж??????????? ??? ??? ?в?? ss_si_id??0 ?????????
????2. ??????SQL????????????SQL???
???????????DB???????????????? ??????????????DB??????????????? 0.xx ??????? 50+ ?????????????????????????????? ??????????????????DB????????????
??????????????????′??????
????1.???????з????SQL??? ?????????WHERE ???????????????????? AND ss_si_id <> 0 ????MySQL??м???????ε??SQL;
????2.DBA ????kill ???????????????DB??????????down????????????????????????? pt-kill ????????ò???????????????
???????????????????
????1.?????????? default ??? SQL ??????????????????????
????2.?????????????С???????????????????·???????