{"id":25965,"date":"2024-11-24T13:27:08","date_gmt":"2024-11-24T05:27:08","guid":{"rendered":"https:\/\/fwq.ai\/blog\/25965\/"},"modified":"2024-11-24T13:27:08","modified_gmt":"2024-11-24T05:27:08","slug":"mysql-%e7%b4%a2%e5%bc%95%e6%94%af%e6%8c%81%e5%93%aa%e4%ba%9b%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/25965\/","title":{"rendered":"MySQL \u7d22\u5f15\u652f\u6301\u54ea\u4e9b\u6570\u636e\u7c7b\u578b\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173076715724213.jpg\" class=\"aligncenter\" title=\"MySQL \u7d22\u5f15\u652f\u6301\u54ea\u4e9b\u6570\u636e\u7c7b\u578b\uff1f\u63d2\u56fe\" alt=\"MySQL \u7d22\u5f15\u652f\u6301\u54ea\u4e9b\u6570\u636e\u7c7b\u578b\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u7d22\u5f15\u652f\u6301\u54ea\u4e9b\u6570\u636e\u7c7b\u578b\uff1f<\/strong><\/p>\n<p>\u5728 mysql \u4e2d\uff0c\u51e0\u4e4e\u6240\u6709\u7c7b\u578b\u7684\u6570\u636e\u5b57\u6bb5\u90fd\u53ef\u4ee5\u5efa\u7acb\u7d22\u5f15\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u6574\u6570\u7c7b\u578b\uff08int\u3001smallint\u3001bigint\uff09<\/li>\n<li>\u5b57\u7b26\u4e32\u7c7b\u578b\uff08varchar\u3001char\u3001text\u3001blob\uff09<\/li>\n<li>\u65e5\u671f\u65f6\u95f4\u7c7b\u578b\uff08date\u3001time\u3001datetime\uff09<\/li>\n<li>\u6d6e\u70b9\u7c7b\u578b\uff08double\u3001float\uff09<\/li>\n<li>\u6570\u5b57\u7c7b\u578b\uff08decimal\uff09<\/li>\n<\/ul>\n<p><strong>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5bf9\u4e8e blob \u548c text \u7c7b\u578b\u5b57\u6bb5\uff0c\u7d22\u5f15\u9700\u8981\u6307\u5b9a\u4e00\u4e2a\u524d\u7f00\u957f\u5ea6\u3002<\/strong> \u4f8b\u5982\uff1a<\/p>\n<pre>CREATE TABLE test (blob_col BLOB, INDEX(blob_col(10)));<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7d22\u5f15\u5c06\u4ec5\u8986\u76d6\u5b57\u6bb5\u7684\u524d 10 \u4e2a\u5b57\u8282\u3002\u524d\u7f00\u957f\u5ea6\u6700\u591a\u53ef\u4ee5\u662f 1000 \u4e2a\u5b57\u8282\uff08\u5bf9\u4e8e innodb \u8868\u4e3a 767 \u5b57\u8282\uff0c\u9664\u975e\u8bbe\u7f6e\u4e86 innodb_large_prefix\uff09\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fMySQL \u7d22\u5f15\u652f\u6301\u54ea\u4e9b\u6570\u636e\u7c7b\u578b\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7d22\u5f15\u652f\u6301\u54ea\u4e9b\u6570\u636e\u7c7b\u578b\uff1f \u5728 mysql \u4e2d\uff0c\u51e0\u4e4e\u6240\u6709\u7c7b\u578b\u7684\u6570\u636e\u5b57\u6bb5\u90fd\u53ef\u4ee5\u5efa\u7acb\u7d22\u5f15\uff0c\u5305\u62ec\uff1a \u6574\u6570\u7c7b\u578b\uff08int\u3001smallint\u3001bigint\uff09 \u5b57\u7b26\u4e32\u7c7b\u578b\uff08varchar\u3001char\u3001text\u3001blob\uff09 \u65e5\u671f\u65f6\u95f4\u7c7b\u578b\uff08date\u3001time\u3001datetime\uff09 \u6d6e\u70b9\u7c7b\u578b\uff08double\u3001float\uff09 \u6570\u5b57\u7c7b\u578b\uff08decimal\uff09 \u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5bf9\u4e8e blob \u548c text \u7c7b\u578b\u5b57\u6bb5\uff0c\u7d22\u5f15\u9700\u8981\u6307\u5b9a\u4e00\u4e2a\u524d\u7f00\u957f\u5ea6\u3002 \u4f8b\u5982\uff1a CREATE TABLE test (blob_col BLOB, INDEX(blob_col(10))); \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7d22\u5f15\u5c06\u4ec5\u8986\u76d6\u5b57\u6bb5\u7684\u524d 10 \u4e2a\u5b57\u8282\u3002\u524d\u7f00\u957f\u5ea6\u6700\u591a\u53ef\u4ee5\u662f 1000 \u4e2a\u5b57\u8282\uff08\u5bf9\u4e8e innodb \u8868\u4e3a 767 \u5b57\u8282\uff0c\u9664\u975e\u8bbe\u7f6e\u4e86 innodb_large_prefix\uff09\u3002 \u4ee5\u4e0a\u5c31\u662fMySQL \u7d22\u5f15\u652f\u6301\u54ea\u4e9b\u6570\u636e\u7c7b\u578b\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-25965","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25965","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=25965"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25965\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=25965"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=25965"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=25965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}