{"id":5463,"date":"2021-04-21T15:11:20","date_gmt":"2021-04-21T07:11:20","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=5463"},"modified":"2021-05-21T15:47:18","modified_gmt":"2021-05-21T07:47:18","slug":"gbase-8a-%e8%87%aa%e5%ae%9a%e4%b9%89%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e6%9f%a5%e7%9c%8b%e9%9b%86%e7%be%a4%e4%bb%bb%e5%8a%a1sql%e7%8a%b6%e6%80%81","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/5463","title":{"rendered":"Nanda General GBase 8a Custom Stored Procedure sp_cluster_processlist View Cluster Task SQL Status"},"content":{"rendered":"\n<p>GBase 8a\u63d0\u4f9b\u4e86show processlist\u547d\u4ee4\u67e5\u770b\u672c\u673a\u7684SQL\u8fd0\u884c\u72b6\u6001\uff0c\u4e5f\u63d0\u4f9b\u4e86COORDINATORS_TASK_INFORMATION\u5143\u6570\u636e\u8868\u6765\u67e5\u770b\u96c6\u7fa4\u6240\u6709\u8c03\u5ea6\u8282\u70b9\u7684SQL\u8fd0\u884c\u72b6\u6001\u3002\u672c\u6587\u63d0\u4f9b\u4e00\u4e2a\u81ea\u5b9a\u4e49\u5b58\u50a8\u8fc7\u7a0b\uff0c\u6765\u7b80\u5316\u8fd0\u7ef4\u4eba\u5458\u7684\u4f7f\u7528\u96be\u5ea6\u3002<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u76ee\u5f55\u5bfc\u822a<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2a9d591720f\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2a9d591720f\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gbase8.cn\/en\/5463\/#%E5%8F%82%E8%80%83\" >\u53c2\u8003<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gbase8.cn\/en\/5463\/#%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B\" >\u5b58\u50a8\u8fc7\u7a0b<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/5463\/#sp_cluster_processlist\" >sp_cluster_processlist<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/5463\/#%E8%B0%83%E7%94%A8\" >\u8c03\u7528<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8F%82%E8%80%83\"><\/span>\u53c2\u8003<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><a href=\"https:\/\/www.gbase8.cn\/65\">GBase8a \u663e\u793a\u96c6\u7fa4\u6b63\u5728\u8dd1\u7684SQL\u8fdb\u7a0bshow [full | detail] processlist<\/a><br><a href=\"https:\/\/www.gbase8.cn\/127\">GBase 8a\u96c6\u7fa4\u67e5\u770b\u6240\u6709\u8282\u70b9\u6b63\u5728\u8fd0\u884c\u7684SQL<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B\"><\/span>\u5b58\u50a8\u8fc7\u7a0b <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u7528\u5230\u7684executeSQL\u901a\u7528\u52a8\u6001SQL\uff0c\u8bf7\u53c2\u8003  <a href=\"https:\/\/www.gbase8.cn\/wp-admin\/post.php?post=226&amp;action=edit\">GBase 8a\u96c6\u7fa4\u5b58\u50a8<\/a><a href=\"https:\/\/www.gbase8.cn\/226\">\u8fc7\u7a0b\u6837\u4f8b\uff0c\u52a8\u6001\u5b58\u50a8\u8fc7\u7a0b<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"sp_cluster_processlist\"><\/span>sp_cluster_processlist<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u53c2\u65701 showSize\uff1a\u663e\u793aSQL\u7684\u5b57\u7b26\u6570\u91cf<br>\u53c2\u65702 topN\uff1a\u663e\u793a\u6267\u884c\u65f6\u95f4\u6700\u957f\u7684SQL\u6570\u91cf\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>drop procedure if exists sp_cluster_processlist;\ndelimiter \/\/\ncreate procedure sp_cluster_processlist(showSize int,topN int)\nbegin\n  set @sql=concat('select COORDINATOR_NAME, ID, user, host, command, start_time, time, state, substring(info,0,'\n    ,showSize\n    ,') info from information_schema.COORDINATORS_TASK_INFORMATION where command=\\'query\\' and info is not null and info not like \\'%information_schema.processlist%\\' order by time desc limit '\n    ,topN);\n  call executeSQL(@sql);\nend\n\/\/\ndelimiter ;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%B0%83%E7%94%A8\"><\/span>\u8c03\u7528<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>call sp_cluster_processlist(100,10);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5357\u5927\u901a\u7528GBase 8a\u63d0\u4f9b\u4e86show processlist\u547d\u4ee4\u67e5\u770b\u672c\u673a\u7684SQL\u8fd0\u884c\u72b6\u6001\uff0c\u4e5f\u63d0\u4f9b\u4e86COORDINATORS_TASK_INFORMATION\u5143\u6570\u636e\u8868\u6765\u67e5\u770b\u96c6\u7fa4\u6240\u6709\u8c03\u5ea6\u8282\u70b9\u7684SQL\u8fd0\u884c\u72b6\u6001\u3002\u672c\u6587\u63d0\u4f9b\u4e00\u4e2a\u81ea\u5b9a\u4e49\u5b58\u50a8\u8fc7\u7a0b\uff0c\u6765\u7b80\u5316\u8fd0\u7ef4\u4eba\u5458\u7684\u4f7f\u7528\u96be\u5ea6\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[28,92],"class_list":["post-5463","post","type-post","status-publish","format-standard","hentry","category-gbase8a","tag-28","tag-92"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/5463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/comments?post=5463"}],"version-history":[{"count":4,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/5463\/revisions"}],"predecessor-version":[{"id":6075,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/5463\/revisions\/6075"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=5463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=5463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=5463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}