{"id":1622,"date":"2022-11-20T23:10:58","date_gmt":"2022-11-20T15:10:58","guid":{"rendered":"https:\/\/qaqaq.top\/?p=1622"},"modified":"2022-11-27T12:40:57","modified_gmt":"2022-11-27T04:40:57","slug":"innodb%e6%95%b0%e6%8d%ae%e5%ad%98%e5%82%a8%e7%bb%93%e6%9e%84%e6%a6%82%e8%bf%b0%e3%80%81%e9%a1%b5%e7%bb%93%e6%9e%84%e4%b9%8b%e6%96%87%e4%bb%b6%e5%a4%b4%e9%83%a8%e4%b8%8e%e6%96%87%e4%bb%b6%e5%b0%be","status":"publish","type":"post","link":"https:\/\/qaqaq.top\/?p=1622","title":{"rendered":"InnoDB\u6570\u636e\u5b58\u50a8\u7ed3\u6784\u6982\u8ff0\u3001\u9875\u7ed3\u6784\u4e4b\u6587\u4ef6\u5934\u90e8\u4e0e\u6587\u4ef6\u5c3e\u90e8\u3001\u9875\u7ed3\u6784\u4e4b\u6700\u5c0f\u6700\u5927\u8bb0\u5f55_\u884c\u683c\u5f0f\u4e4b\u8bb0\u5f55\u5934\u4fe1\u606f\u3001\u9875\u7ed3\u6784\u4e4b\u9875\u76ee\u5f55\u4e0e\u9875\u5934\u3001\u8bbe\u7f6e\u884c\u683c\u5f0f\u4e0eibd\u6587\u4ef6\u5256\u6790Compact\u884c\u683c\u5f0f\u3001\u884c\u6ea2\u51fa\u4e0eDynamic\u3001Compressed\u3001Redundant\u884c\u683c\u5f0f\u3001\u533a\u3001\u6bb5\u3001\u788e\u7247\u533a\u4e0e\u8868\u7a7a\u95f4\u7ed3\u6784"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code># \u7b2c07\u7ae0_InnoDB\u6570\u636e\u5b58\u50a8\u7ed3\u6784\n\n# 1. \u6570\u636e\u5e93\u7684\u5b58\u50a8\u7ed3\u6784\uff1a\u9875\n\n# \u9875\u7684\u5927\u5c0f\n\nSHOW VARIABLES LIKE '%innodb_page_size%';\n\n# 3. InnoDB\u884c\u683c\u5f0f\uff08\u6216\u8bb0\u5f55\u683c\u5f0f\uff09\n\n# \u67e5\u770bMySQL8\u7684\u9ed8\u8ba4\u884c\u683c\u5f0f\nSELECT @@innodb_default_row_format;\n\n# \u67e5\u770b\u5177\u4f53\u8868\u4f7f\u7528\u7684\u884c\u683c\u5f0f\nUSE dbtest1;\n\nSHOW TABLES;\n\nSHOW TABLE STATUS LIKE 'emp1';\n\n# \u5728\u521b\u5efa\u6216\u4fee\u6539\u8868\u7684\u8bed\u53e5\u4e2d\u6307\u5b9a\u884c\u683c\u5f0f\nCREATE TABLE emp5(id INT,name VARCHAR(15)) ROW_FORMAT=COMPACT;\n\nSHOW TABLE STATUS LIKE 'emp5';\n\nSHOW TABLE STATUS LIKE 'emp2';\n\nALTER TABLE emp2 ROW_FORMAT=COMPACT;\n\nSHOW TABLE STATUS LIKE 'emp2';\n\n# \u4e3e\u4f8b\uff1a\u5206\u6790Compact\u884c\u8bb0\u5f55\u7684\u5185\u90e8\u7ed3\u6784\uff1a\n\nCREATE TABLE mytest(\n    col1 VARCHAR(10),\n    col2 VARCHAR(10),\n    col3 CHAR(10),\n    col4 VARCHAR(10)\n)ENGINE=INNODB CHARSET=LATIN1 ROW_FORMAT=COMPACT;\n\nINSERT INTO mytest\nVALUES('a','bb','bb','ccc');\n\nINSERT INTO mytest\nVALUES('d','ee','ee','fff');\n\nINSERT INTO mytest\nVALUES('d',NULL,NULL,'fff');\n\n# \u884c\u6ea2\u51fa\n\nCREATE TABLE varchar_size_demo(\n    c VARCHAR(65535)\n)CHARSET=ASCII ROW_FORMAT=COMPACT;\n\nCREATE TABLE varchar_size_demo0(\n    c VARCHAR(65535)\n);\n\nCREATE TABLE varchar_size_demo(\n    c VARCHAR(65532)    #65532 + 2\u5b57\u8282\u7684\u53d8\u957f\u5b57\u6bb5\u7684\u957f\u5ea6 + 1NULL\u503c\u6807\u8bc6\n)CHARSET=ASCII ROW_FORMAT=COMPACT;\n\nCREATE TABLE varchar_size_demo1(\n    c VARCHAR(65533) NOT NULL    #65533 + 2\u5b57\u8282\u7684\u53d8\u957f\u5b57\u6bb5\u7684\u957f\u5ea6\n)CHARSET=ASCII ROW_FORMAT=COMPACT;\n\nCREATE TABLE varchar_size_demo2(\n    c VARCHAR(65534) NOT NULL    #65533 + 2\u5b57\u8282\u7684\u53d8\u957f\u5b57\u6bb5\u7684\u957f\u5ea6\n)CHARSET=ASCII ROW_FORMAT=COMPACT;\n\n# 5.\u8868\u7a7a\u95f4\n\n# 5.1 \u72ec\u7acb\u8868\u7a7a\u95f4\n\nUSE dbtest1;\n\nSHOW TABLES;\n\nCREATE TABLE temp(id INT,name VARCHAR(15));\n\nSHOW ENGINES;\n\n# \u67e5\u770bInnoDB\u7684\u8868\u7a7a\u95f4\u7c7b\u578b\n\nSHOW VARIABLES LIKE 'innodb_file_per_table';<\/code><\/pre>\n\n\n\n<p>ibd\u6587\u4ef6\u5256\u6790Compact\u884c\u683c\u5f0f<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/qaqaq.top\/wp-content\/uploads\/2022\/11\/ibd\u6587\u4ef6\u5256\u6790Compact\u884c\u683c\u5f0f.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"582\" height=\"173\" data-original=\"https:\/\/qaqaq.top\/wp-content\/uploads\/2022\/11\/ibd\u6587\u4ef6\u5256\u6790Compact\u884c\u683c\u5f0f.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-1625\"  sizes=\"(max-width: 582px) 100vw, 582px\" \/><\/div><\/figure>\n\n\n\n<p>\u5206\u6790\u5185\u5bb9 \u7565<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ibd\u6587\u4ef6\u5256\u6790Compact\u884c\u683c\u5f0f \u5206\u6790\u5185\u5bb9 \u7565<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[47],"class_list":["post-1622","post","type-post","status-publish","format-standard","hentry","category-mysql-code","tag-mysql"],"_links":{"self":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/1622"}],"collection":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1622"}],"version-history":[{"count":3,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/1622\/revisions"}],"predecessor-version":[{"id":1629,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/1622\/revisions\/1629"}],"wp:attachment":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}