{"id":512173,"date":"2021-06-12T11:24:10","date_gmt":"2021-06-12T03:24:10","guid":{"rendered":"http:\/\/4563.org\/?p=512173"},"modified":"2021-06-12T11:24:10","modified_gmt":"2021-06-12T03:24:10","slug":"%e5%85%b3%e4%ba%8e-mysql-%e8%81%94%e8%a1%a8%e6%89%a7%e8%a1%8c%e9%a1%ba%e5%ba%8f%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=512173","title":{"rendered":"\u5173\u4e8e mysql \u8054\u8868\u6267\u884c\u987a\u5e8f\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1> \u5173\u4e8e mysql \u8054\u8868\u6267\u884c\u987a\u5e8f\u95ee\u9898 <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : simonlu9 <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<h2>user \u8868\u7684\u8bb0\u5f55\u6709\u51e0\u767e\u4e07\uff0cupdate_time \u6709\u7d22\u5f15\uff0climit 0,20 \u548c limit 19999,20 \u7684\u6548\u679c\u4e5f\u662f\u4e00\u6837<\/h2>\n<pre><code>SELECT  * FROM  USER user0_ LEFT JOIN user_statistic userstatis1_ ON user0_.user_statistic_id = userstatis1_.id LEFT JOIN language_level languagele2_ ON user0_.language_level_id = languagele2_.id LEFT JOIN user_contact usercontac3_ ON user0_.user_contact_id = usercontac3_.id LEFT JOIN user_social_info usersocial4_ ON user0_.user_social_info_id = usersocial4_.id LEFT JOIN user_detail userdetail5_ ON user0_.user_detail_id = userdetail5_.id WHERE  user0_.update_time &gt; '2021-06-23 09:40:00.019' ORDER BY  user0_.update_time ASC LIMIT 0,  20     \u6267\u884c\u8ba1\u5212 1 SIMPLE user0_  range idx_update_time idx_update_time 6  1143267 100 Using index condition; Using temporary; Using filesort 1 SIMPLE userstatis1_  eq_ref PRIMARY PRIMARY 150 flo.user0_.user_statistic_id 1 100  1 SIMPLE languagele2_  ALL     7 100 Using where; Using join buffer (Block Nested Loop) 1 SIMPLE usercontac3_  eq_ref PRIMARY PRIMARY 150 flo.user0_.user_contact_id 1 100  1 SIMPLE usersocial4_  eq_ref PRIMARY PRIMARY 150 flo.user0_.user_social_info_id 1 100  1 SIMPLE userdetail5_  eq_ref PRIMARY PRIMARY 150 flo.user0_.user_detail_id 1 100    <\/code><\/pre>\n<p>\u4e0a\u9762\u7684\u8bed\u53e5\u5f88\u660e\u663e\u4ece\u7d22\u5f15\u627e\u51fa\u7b26\u5408\u7684\u6761\u4ef6\u7136\u540e\u56de\u8868\u5728\u4e34\u65f6\u8868\u6392\u5e8f \u4e0d\u592a\u660e\u767d mysql \u4e3a\u4ec0\u4e48\u4e0d\u6839\u636e\u7d22\u5f15\u6392\u5e8f\u540e\u7684 row_id \u56de\u8868\u8fdb\u884c\u67e5\u8be2\uff0c\u672c\u8eab\u7d22\u5f15\u4e5f\u662f\u6709\u5e8f\u7684\uff0c\u8fc7\u6ee4 20 \u884c\u56de\u8868\u4e0d\u5c31\u53ef\u4ee5\u4e86\u5417 \u96be\u9053\u56de\u8868\u7684\u968f\u673a\u67e5\u8be2\u5bfc\u81f4\u5206\u6790\u6210\u672c\u8fc7\u9ad8\uff0c<\/p>\n<p>\u6539\u5199\u540e<\/p>\n<pre><code>SELECT  * FROM  (   SELECT    *   FROM    USER   WHERE    USER .update_time &gt; '2021-06-23 09:40:00.019'   ORDER BY    USER .update_time ASC   LIMIT 0,   20  ) user0_ LEFT OUTER JOIN user_statistic userstatis1_ ON user0_.user_statistic_id = userstatis1_.id LEFT OUTER JOIN language_level languagele2_ ON user0_.language_level_id = languagele2_.id LEFT OUTER JOIN user_contact usercontac3_ ON user0_.user_contact_id = usercontac3_.id LEFT OUTER JOIN user_social_info usersocial4_ ON user0_.user_social_info_id = usersocial4_.id LEFT OUTER JOIN user_detail userdetail5_ ON user0_.user_detail_id = userdetail5_.id;   \u6267\u884c\u8ba1\u5212 1 PRIMARY &lt;derived2&gt;  ALL     20 100  1 PRIMARY userstatis1_  eq_ref PRIMARY PRIMARY 150 user0_.user_statistic_id 1 100  1 PRIMARY languagele2_  ALL     7 100 Using where; Using join buffer (Block Nested Loop) 1 PRIMARY usercontac3_  eq_ref PRIMARY PRIMARY 150 user0_.user_contact_id 1 100  1 PRIMARY usersocial4_  eq_ref PRIMARY PRIMARY 150 user0_.user_social_info_id 1 100  1 PRIMARY userdetail5_  eq_ref PRIMARY PRIMARY 150 user0_.user_detail_id 1 100  2 DERIVED user  range idx_update_time idx_update_time 6  1143267 100 Using index condition  <\/code><\/pre>\n<p>\u6267\u884c\u65f6\u95f4\u5927\u5927\u7f29\u51cf\u4e86\uff0c\u6ca1\u6709\u4e34\u65f6\u8868\u548c\u6587\u4ef6\u6392\u5e8f\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>) <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"6038324\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : justfindu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u4e0b\u9762\u8fd9\u4e2a\u5c31 20 \u6761\u8fdb\u884c\u67e5\u8be2 \u5f53\u7136\u6548\u7387\u5927\u5927\u63d0\u5347 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"6038325\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : simonlu9 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @justfindu \u4e0a\u9762\u90a3\u6761\u4e5f\u662f 20 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"6038326\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : liprais <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div>  \u8fd9\u4fe9\u8bed\u4e49\u90fd\u4e0d\u4e00\u6837&#8230; <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"6038327\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : justfindu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @simonlu9 #2 \u660e\u663e\u4e0d\u662f 20 \u5440 0 0 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"6038328\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : simonlu9 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @justfindu \u6211\u660e\u767d\u4f60\u7684\u610f\u601d\u662f left join \u51fa\u6765\u53ef\u80fd\u662f\u4e00\u5bf9\u591a\uff0c\u6240\u4ee5\u4e0b\u9762\u90a3\u4e2a 20 \u548c\u4e0a\u9762\u90a3\u4e2a 20 \u53ef\u80fd\u8fd4\u56de\u7ed3\u679c\u4e0d\u4e00\u6837\u3002 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"6038329\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : pabupa <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u501f\u6587\u9769\u53e6\u5916\u7684\u95ee\u9898\uff0c\u6211\u5199\u6210 &#8220;select * from a,b,c where a.id =b.aid and a.id =c.aid where a.updste_time &gt; &#8216;2001-12-30&#8242;&#8221;\u8fd9\u6837\u3002\u5b83\u4f1a\u88ab\u4f18\u5316\u6210\u4e0a\u9762\u4e24\u79cd\u7684\u90a3\u4e00\u79cd\u5440\uff1f <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"6038330\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : pabupa <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @pabupa \u201c\u95ee\u4e2a\u201d\uff0c\uff0c\uff0c\u6211\u64e6 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"6038331\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : pabupa <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @pabupa \u6211\u89c9\u5f97\u4f1a\u662f\u7b2c\u4e00\u79cd\uff0c\uff0c\uff0c <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5173\u4e8e mysql \u8054\u8868\u6267\u884c\u987a\u5e8f\u95ee\u9898&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/512173"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=512173"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/512173\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=512173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=512173"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=512173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}