{"id":187280,"date":"2024-11-11T12:57:18","date_gmt":"2024-11-11T04:57:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/187280\/"},"modified":"2024-11-11T12:57:19","modified_gmt":"2024-11-11T04:57:19","slug":"%e6%95%b8%e6%93%9a%e5%ba%ab%e7%b4%a2%e5%bc%95%ef%bc%9a%e5%84%aa%e5%8c%96%e6%95%b8%e6%93%9a%e6%9f%a5%e8%a9%a2%e7%9a%84%e5%bf%85%e8%a6%81%e5%b7%a5%e5%85%b7-%e6%95%b8%e6%93%9a%e5%ba%ab%e7%b4%a2%e5%bc%95","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/187280\/","title":{"rendered":"\u6578\u64da\u5eab\u7d22\u5f15\uff1a\u512a\u5316\u6578\u64da\u67e5\u8a62\u7684\u5fc5\u8981\u5de5\u5177 (\u6578\u64da\u5eab\u7d22\u5f15\u7684\u61c9\u7528)"},"content":{"rendered":"<h1 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e7%b4%a2%e5%bc%95%ef%bc%9a%e5%84%aa%e5%8c%96%e6%95%b8%e6%93%9a%e6%9f%a5%e8%a9%a2%e7%9a%84%e5%bf%85%e8%a6%81%e5%b7%a5%e5%85%b7-ePjgUUQozY\">\u6578\u64da\u5eab\u7d22\u5f15\uff1a\u512a\u5316\u6578\u64da\u67e5\u8a62\u7684\u5fc5\u8981\u5de5\u5177<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u64da\u9a45\u52d5\u7684\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u5eab\u7684\u6027\u80fd\u5c0d\u65bc\u61c9\u7528\u7a0b\u5e8f\u7684\u6548\u7387\u81f3\u95dc\u91cd\u8981\u3002\u6578\u64da\u5eab\u7d22\u5f15\u4f5c\u70ba\u4e00\u7a2e\u512a\u5316\u6578\u64da\u67e5\u8a62\u7684\u5de5\u5177\uff0c\u80fd\u5920\u986f\u8457\u63d0\u9ad8\u67e5\u8a62\u901f\u5ea6\uff0c\u6e1b\u5c11\u6578\u64da\u6aa2\u7d22\u7684\u6642\u9593\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u6578\u64da\u5eab\u7d22\u5f15\u7684\u6982\u5ff5\u3001\u985e\u578b\u53ca\u5176\u5728\u5be6\u969b\u61c9\u7528\u4e2d\u7684\u91cd\u8981\u6027\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e6%95%b8%e6%93%9a%e5%ba%ab%e7%b4%a2%e5%bc%95%ef%bc%9f-ePjgUUQozY\">\u4ec0\u9ebc\u662f\u6578\u64da\u5eab\u7d22\u5f15\uff1f<\/h2>\n<p>\u6578\u64da\u5eab\u7d22\u5f15\u662f\u4e00\u7a2e\u6578\u64da\u7d50\u69cb\uff0c\u65e8\u5728\u63d0\u9ad8\u6578\u64da\u6aa2\u7d22\u7684\u6548\u7387\u3002\u5b83\u985e\u4f3c\u65bc\u66f8\u7c4d\u7684\u76ee\u9304\uff0c\u5e6b\u52a9\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff08DBMS\uff09\u5feb\u901f\u5b9a\u4f4d\u6240\u9700\u7684\u6578\u64da\u3002\u7d22\u5f15\u901a\u5e38\u6703\u5728\u4e00\u500b\u6216\u591a\u500b\u5217\u4e0a\u5275\u5efa\uff0c\u4e26\u4e14\u53ef\u4ee5\u986f\u8457\u6e1b\u5c11\u67e5\u8a62\u7684\u57f7\u884c\u6642\u9593\u3002<\/p>\n<h2 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e7%b4%a2%e5%bc%95%e7%9a%84%e9%a1%9e%e5%9e%8b-ePjgUUQozY\">\u6578\u64da\u5eab\u7d22\u5f15\u7684\u985e\u578b<\/h2>\n<p>\u6578\u64da\u5eab\u7d22\u5f15\u6709\u591a\u7a2e\u4e0d\u540c\u7684\u985e\u578b\uff0c\u6bcf\u7a2e\u90fd\u6709\u5176\u7279\u5b9a\u7684\u7528\u9014\u548c\u512a\u7f3a\u9ede\u3002\u4ee5\u4e0b\u662f\u5e7e\u7a2e\u5e38\u898b\u7684\u7d22\u5f15\u985e\u578b\uff1a<\/p>\n<ul>\n<li><strong>\u55ae\u5217\u7d22\u5f15\uff1a<\/strong>\u9019\u662f\u6700\u57fa\u672c\u7684\u7d22\u5f15\u985e\u578b\uff0c\u50c5\u5728\u4e00\u500b\u5217\u4e0a\u5275\u5efa\u3002\u9069\u5408\u65bc\u67e5\u8a62\u4e2d\u53ea\u6d89\u53ca\u55ae\u4e00\u5217\u7684\u60c5\u6cc1\u3002<\/li>\n<li><strong>\u8907\u5408\u7d22\u5f15\uff1a<\/strong>\u5728\u591a\u500b\u5217\u4e0a\u5275\u5efa\u7684\u7d22\u5f15\uff0c\u9069\u5408\u65bc\u67e5\u8a62\u4e2d\u6d89\u53ca\u591a\u500b\u5217\u7684\u60c5\u6cc1\u3002\u8907\u5408\u7d22\u5f15\u7684\u9806\u5e8f\u975e\u5e38\u91cd\u8981\uff0c\u56e0\u70ba\u5b83\u6703\u5f71\u97ff\u67e5\u8a62\u7684\u6027\u80fd\u3002<\/li>\n<li><strong>\u552f\u4e00\u7d22\u5f15\uff1a<\/strong>\u78ba\u4fdd\u7d22\u5f15\u5217\u4e2d\u7684\u6bcf\u500b\u503c\u90fd\u662f\u552f\u4e00\u7684\uff0c\u9019\u5c0d\u65bc\u4e3b\u9375\u548c\u67d0\u4e9b\u696d\u52d9\u908f\u8f2f\u975e\u5e38\u91cd\u8981\u3002<\/li>\n<li><strong>\u5168\u6587\u7d22\u5f15\uff1a<\/strong>\u4e3b\u8981\u7528\u65bc\u6587\u672c\u641c\u7d22\uff0c\u80fd\u5920\u5feb\u901f\u67e5\u627e\u5305\u542b\u7279\u5b9a\u55ae\u8a5e\u6216\u77ed\u8a9e\u7684\u8a18\u9304\u3002<\/li>\n<li><strong>\u54c8\u5e0c\u7d22\u5f15\uff1a<\/strong>\u4f7f\u7528\u54c8\u5e0c\u8868\u4f86\u5b58\u5132\u7d22\u5f15\uff0c\u9069\u5408\u65bc\u7b49\u503c\u67e5\u8a62\uff0c\u4f46\u4e0d\u652f\u6301\u7bc4\u570d\u67e5\u8a62\u3002<\/li>\n<\/ul>\n<h2 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e7%b4%a2%e5%bc%95%e7%9a%84%e5%84%aa%e5%8b%a2-ePjgUUQozY\">\u6578\u64da\u5eab\u7d22\u5f15\u7684\u512a\u52e2<\/h2>\n<p>\u4f7f\u7528\u6578\u64da\u5eab\u7d22\u5f15\u7684\u4e3b\u8981\u512a\u52e2\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u63d0\u9ad8\u67e5\u8a62\u901f\u5ea6\uff1a<\/strong>\u7d22\u5f15\u80fd\u5920\u986f\u8457\u6e1b\u5c11\u67e5\u8a62\u6240\u9700\u7684\u6642\u9593\uff0c\u7279\u5225\u662f\u5728\u8655\u7406\u5927\u91cf\u6578\u64da\u6642\u3002<\/li>\n<li><strong>\u6e1b\u5c11I\/O\u64cd\u4f5c\uff1a<\/strong>\u901a\u904e\u7d22\u5f15\uff0c\u6578\u64da\u5eab\u53ef\u4ee5\u66f4\u5feb\u5730\u5b9a\u4f4d\u5230\u6240\u9700\u7684\u6578\u64da\uff0c\u5f9e\u800c\u6e1b\u5c11\u78c1\u789fI\/O\u64cd\u4f5c\u3002<\/li>\n<li><strong>\u652f\u6301\u6392\u5e8f\u548c\u7be9\u9078\uff1a<\/strong>\u7d22\u5f15\u53ef\u4ee5\u52a0\u901fORDER BY\u548cWHERE\u5b50\u53e5\u7684\u57f7\u884c\uff0c\u9032\u4e00\u6b65\u63d0\u9ad8\u67e5\u8a62\u6548\u7387\u3002<\/li>\n<\/ul>\n<h2 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e7%b4%a2%e5%bc%95%e7%9a%84%e6%87%89%e7%94%a8%e7%a4%ba%e4%be%8b-ePjgUUQozY\">\u6578\u64da\u5eab\u7d22\u5f15\u7684\u61c9\u7528\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684SQL\u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u5728MySQL\u4e2d\u5275\u5efa\u7d22\u5f15\uff1a<\/p>\n<pre><code>CREATE INDEX idx_user_email ON users(email);<\/code><\/pre>\n<p>\u5728\u9019\u500b\u4f8b\u5b50\u4e2d\uff0c\u6211\u5011\u5728\u201cusers\u201d\u8868\u7684\u201cemail\u201d\u5217\u4e0a\u5275\u5efa\u4e86\u4e00\u500b\u7d22\u5f15\uff0c\u9019\u6a23\u5728\u67e5\u8a62\u7528\u6236\u96fb\u5b50\u90f5\u4ef6\u6642\uff0c\u6578\u64da\u5eab\u53ef\u4ee5\u66f4\u5feb\u5730\u627e\u5230\u6240\u9700\u7684\u8a18\u9304\u3002<\/p>\n<p>\u53e6\u4e00\u500b\u4f8b\u5b50\u662f\u5275\u5efa\u8907\u5408\u7d22\u5f15\uff1a<\/p>\n<pre><code>CREATE INDEX idx_user_name_age ON users(name, age);<\/code><\/pre>\n<p>\u9019\u500b\u7d22\u5f15\u5c07\u5728\u201cname\u201d\u548c\u201cage\u201d\u5169\u500b\u5217\u4e0a\u5275\u5efa\uff0c\u9069\u5408\u65bc\u540c\u6642\u67e5\u8a62\u9019\u5169\u500b\u689d\u4ef6\u7684\u60c5\u6cc1\u3002<\/p>\n<h2 id=\"%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-ePjgUUQozY\">\u6ce8\u610f\u4e8b\u9805<\/h2>\n<p>\u5118\u7ba1\u7d22\u5f15\u80fd\u5920\u63d0\u9ad8\u67e5\u8a62\u6027\u80fd\uff0c\u4f46\u904e\u591a\u7684\u7d22\u5f15\u4e5f\u6703\u5e36\u4f86\u4e00\u4e9b\u554f\u984c\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li><strong>\u589e\u52a0\u5beb\u5165\u5ef6\u9072\uff1a<\/strong>\u6bcf\u7576\u5c0d\u8868\u9032\u884c\u63d2\u5165\u3001\u66f4\u65b0\u6216\u522a\u9664\u64cd\u4f5c\u6642\uff0c\u76f8\u95dc\u7684\u7d22\u5f15\u4e5f\u9700\u8981\u66f4\u65b0\uff0c\u9019\u6703\u589e\u52a0\u5beb\u5165\u64cd\u4f5c\u7684\u5ef6\u9072\u3002<\/li>\n<li><strong>\u4f54\u7528\u984d\u5916\u7a7a\u9593\uff1a<\/strong>\u7d22\u5f15\u6703\u4f54\u7528\u984d\u5916\u7684\u78c1\u789f\u7a7a\u9593\uff0c\u7279\u5225\u662f\u5728\u5927\u578b\u6578\u64da\u96c6\u4e0a\u3002<\/li>\n<\/ul>\n<p>\u56e0\u6b64\uff0c\u5728\u8a2d\u8a08\u6578\u64da\u5eab\u6642\uff0c\u9700\u8981\u6839\u64da\u5be6\u969b\u9700\u6c42\u5408\u7406\u898f\u5283\u7d22\u5f15\u7684\u4f7f\u7528\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-ePjgUUQozY\">\u7e3d\u7d50<\/h2>\n<p>\u6578\u64da\u5eab\u7d22\u5f15\u662f\u512a\u5316\u6578\u64da\u67e5\u8a62\u7684\u91cd\u8981\u5de5\u5177\uff0c\u80fd\u5920\u986f\u8457\u63d0\u9ad8\u67e5\u8a62\u6027\u80fd\u548c\u6548\u7387\u3002\u901a\u904e\u5408\u7406\u4f7f\u7528\u5404\u7a2e\u7d22\u5f15\u985e\u578b\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u5728\u8655\u7406\u5927\u91cf\u6578\u64da\u6642\u7372\u5f97\u66f4\u597d\u7684\u6027\u80fd\u3002\u7136\u800c\uff0c\u904e\u591a\u7684\u7d22\u5f15\u4e5f\u53ef\u80fd\u5c0e\u81f4\u6027\u80fd\u4e0b\u964d\uff0c\u56e0\u6b64\u5728\u8a2d\u8a08\u6578\u64da\u5eab\u6642\u9700\u8b39\u614e\u8003\u616e\u3002\u5c0d\u65bc\u9700\u8981\u9ad8\u6548\u6578\u64da\u8655\u7406\u7684\u61c9\u7528\uff0c\u9078\u64c7\u5408\u9069\u7684<a href=\"https:\/\/server.hk\">VPS<\/a>\u6216<a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a>\u89e3\u6c7a\u65b9\u6848\u5c07\u662f\u660e\u667a\u4e4b\u8209\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u7d22\u6578\u64da\u5eab\u7d22\u5f15\u7684\u61c9\u7528\uff0c\u4e86\u89e3\u5982\u4f55\u512a\u5316\u6578\u64da\u67e5\u8a62\uff0c\u63d0\u9ad8\u6548\u7387\uff0c\u63d0\u5347\u7cfb\u7d71\u6027\u80fd\u7684\u5fc5\u8981\u5de5\u5177\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-187280","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/187280","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=187280"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/187280\/revisions"}],"predecessor-version":[{"id":187281,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/187280\/revisions\/187281"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=187280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=187280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=187280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}