{"id":3526,"date":"2018-12-11T13:22:18","date_gmt":"2018-12-11T05:22:18","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=3526"},"modified":"2018-12-11T13:22:18","modified_gmt":"2018-12-11T05:22:18","slug":"%e4%bd%bf%e7%94%a8-show-session-status-like-handler-%e6%9b%bf%e4%bb%a3-explain-rows-%e4%bc%b0%e7%ae%97%e4%b8%8d%e5%87%86%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=3526","title":{"rendered":"\u4f7f\u7528 SHOW SESSION STATUS LIKE &#8220;Handler%&#8221; \u66ff\u4ee3 EXPLAIN ROWS \u4f30\u7b97\u4e0d\u51c6\u95ee\u9898"},"content":{"rendered":"<p>\n\t\u63a5\u4e0a\u4e00\u7bc7\uff0c\u6211\u89e3\u91ca\u4e86\u4e3a\u4ec0\u4e48 EXPLAIN \u4f30\u7b97 ROWS \u4e0d\u51c6\u786e\uff1f\u5e76\u4e14\u89e3\u91ca\u4e86 ROWS \u7684\u8ba1\u7b97\u539f\u7406\u3002\u672c\u6587\uff0c\u6211\u4eec\u5728\u6765\u8bf4\u4e00\u4e0b\uff0cROWS \u8ba1\u7b97\u4e0d\u51c6\u786e\uff0c\u6709\u6ca1\u6709\u66ff\u4ee3\u65b9\u6848\uff1f\n<\/p>\n<p>\n\t\u66ff\u4ee3\u65b9\u6cd5\u80af\u5b9a\u6709\uff0c\u770b\u6807\u9898\uff0c\u6ce8\u610f\u6807\u9898\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u8bf4\u8bf4 SHOW STATUS\u3002\n<\/p>\n<p>\n\t\u5728 MySQL \u6027\u80fd\u8c03\u8bd5\u4e2d\uff0cEXPLAIN \u80fd\u591f\u89e3\u91ca MySQL \u6267\u884c\u8ba1\u5212\uff0c\u4ece\u800c\u7528\u6765\u4f30\u7b97\u6027\u80fd\u8017\u65f6\u3002\u5176\u4e2d\uff0crows \u7528\u6765\u8868\u793a\u5728 SQL \u6267\u884c\u8fc7\u7a0b\u4e2d\u4f1a\u88ab\u626b\u63cf\u7684\u884c\u6570\uff0c\u8be5\u503c\u8d8a\u5927\uff0c\u610f\u5473\u7740\u9700\u8981\u626b\u63cf\u7684\u884c\u6570\uff0c\u76f8\u5e94\u7684\u8017\u65f6\u66f4\u957f\u3002\u4f46\u662f\u9700\u8981\u6ce8\u610f\u7684\u662f EXPLAIN \u4e2d\u8f93\u51fa\u7684 rows \u53ea\u662f\u4e00\u4e2a\u4f30\u7b97\u503c\uff0c\u4e0d\u80fd\u5b8c\u5168\u5bf9\u5176\u767e\u5206\u4e4b\u767e\u76f8\u4fe1\uff0c\u5982 EXPLAIN \u4e2d\u5bf9 LIMITS \u7684\u652f\u6301\u5c31\u6bd4\u8f83\u6709\u9650\u3002\n<\/p>\n<p>\n\t\u4f7f\u7528 SHOW SESSION STATUS LIKE &quot;Handler%&quot; \u6b63\u597d\u53ef\u4ee5\u89e3\u51b3\u8fd9\u7c7b\u95ee\u9898\u3002\n<\/p>\n<p>\n\t\u5177\u4f53\u7528\u6cd5\u5982\u4e0b\uff1a\n<\/p>\n<pre class=\"brush:sql;\">\r\nSELECT * FROM XTTBLOG WHERE TYPE = &#039;JAVA&#039; ORDER BY CREATED_TIME DESC LIMIT 10;<\/pre>\n<p>\n\t\u6267\u884c SHOW SESSION STATUS LIKE &quot;Handler%&quot; \u67e5\u770b\u5f53\u524d\u72b6\u6001\uff1a\n<\/p>\n<pre class=\"brush:sql;\">\r\nSHOW SESSION STATUS LIKE &quot;Handler%&quot;<\/pre>\n<p>\n\t\u8fd4\u56de\u7684\u7ed3\u679c\u7c7b\u4f3c\u5982\u4e0b\uff1a\n<\/p>\n<pre class=\"brush:plain;\">\r\nVariable_nameValue\r\nHandler_commit 1\r\nHandler_delete 0\r\nHandler_discover 0\r\nHandler_external_lock 2\r\nHandler_mrr_init 0\r\nHandler_prepare 0\r\nHandler_read_first 1\r\nHandler_read_key 2\r\nHandler_read_last 0\r\nHandler_read_next 0\r\nHandler_read_prev9\r\nHandler_read_rnd 0\r\nHandler_read_rnd_next 3\r\nHandler_rollback 0\r\nHandler_savepoint 0\r\nHandler_savepoint_rollback 0\r\nHandler_update 0\r\nHandler_write 0<\/pre>\n<p>\n\t\u67e5\u770b Handler_read_prev \u7684\u503c\uff0c\u53d1\u73b0\u662f 9\u3002\u53ef\u4ee5\u770b\u5230\u8fd8\u5269 9 \u6761\u6570\u636e\u6ca1\u6709\u8bfb\uff0c\u8fd9\u624d\u662f\u5b9e\u9645\u51c6\u786e\u7684\u503c\u3002\n<\/p>\n<h2>\n\tshow status \u5e38\u7528\u547d\u4ee4<br \/>\n<\/h2>\n<pre class=\"brush:sql;\">\r\n-- \u67e5\u8be2\u8fd4\u56de\u7684\u884c\u6570\r\nshow status like &#039;%innodb_rows_read%&#039;\r\n\r\n-- \u63d2\u5165\u6210\u529f\u7684\u884c\u6570\r\nshow status like &#039;%innodb_rows_inserted%&#039;\r\n\r\n-- \u66f4\u65b0\u6210\u529f\u7684\u884c\u6570\r\nshow status like &#039;%innodb_rows_updated%&#039;\r\n\r\n-- \u5220\u9664\u6210\u529f\u7684\u884c\u6570\r\nshow status like &#039;%innodb_rows_deleted%&#039;\r\n\r\n-- \u67e5\u770b\u9501\r\nSELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;\r\nshow status like &#039;%innodb_status%&#039;\r\n-- show status like &#039;%Table%&#039;\r\n\r\n-- \u67e5\u770b\u6162\u67e5\u8be2\r\nshow status like &#039;%Slow%&#039;\r\n\r\n-- \u67e5\u770b\u8fd0\u884c\u65f6\u95f4\r\nshow status like &#039;%up%&#039;\r\n\r\n-- \u67e5\u770b\u9501\u7684\u65f6\u95f4\u5206\u5e03\r\nshow status like&#039;%innodb_row_lock%&#039;;\r\n\r\n-- \u6267\u884cselect\u7684\u8ba1\u6570\r\nshow status like &#039;%Com_select%&#039;\r\n\r\n-- \u6267\u884cinsert\u7684\u8ba1\u6570\uff0c\u6279\u91cf\u63d2\u5165\u7b97\u4e00\u6b21\r\nshow status like &#039;%Com_insert%&#039;\r\n\r\n-- \u6267\u884c\u66f4\u65b0\u64cd\u4f5c\u7684\u8ba1\u6570\r\nshow status like &#039;%Com_update%&#039;\r\n\r\n-- \u6267\u884c\u5220\u9664\u64cd\u4f5c\u7684\u8ba1\u6570\r\nshow status like &#039;%Com_delete%&#039;\r\n\r\n-- \u63d0\u4ea4\u4e8b\u52a1\u8ba1\u6570\r\nshow status like &#039;%Com_commit%&#039;\r\n\r\n-- \u56de\u6eda\u4e8b\u52a1\u8ba1\u6570\r\nshow status like &#039;%Com_rollback%&#039;\r\n\r\n-- \u67e5\u770b\u8b66\u544a\u4fe1\u606f\r\nshow warnings<\/pre>\n<h2>\n\t\u53c2\u8003\u8d44\u6599<br \/>\n<\/h2>\n<ul>\n<li>\n\t\t<a href=\"https:\/\/www.percona.com\/blog\/2006\/07\/24\/mysql-explain-limits-and-errors\/\" name=\"MySQL EXPLAIN limits and errors.\" target=\"_blank\" title=\"MySQL EXPLAIN limits and errors.\">MySQL EXPLAIN limits and errors.<\/a>\n\t<\/li>\n<\/ul>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=3526\">\u4f7f\u7528 SHOW SESSION STATUS LIKE &#8220;Handler%&#8221; \u66ff\u4ee3 EXPLAIN ROWS \u4f30\u7b97\u4e0d\u51c6\u95ee\u9898<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u63a5\u4e0a\u4e00\u7bc7\uff0c\u6211\u89e3\u91ca\u4e86\u4e3a\u4ec0\u4e48 EXPLAIN \u4f30\u7b97 ROWS \u4e0d\u51c6\u786e\uff1f\u5e76\u4e14\u89e3\u91ca\u4e86 ROWS \u7684\u8ba1\u7b97\u539f\u7406\u3002\u672c\u6587\uff0c\u6211\u4eec [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[689,83,580,392,447],"class_list":["post-3526","post","type-post","status-publish","format-standard","hentry","category-sql","tag-explain","tag-mysql","tag-mysql----dba"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3526"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3526\/revisions"}],"predecessor-version":[{"id":3527,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3526\/revisions\/3527"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}