{"id":5987,"date":"2022-09-09T17:25:41","date_gmt":"2022-09-09T14:25:41","guid":{"rendered":"https:\/\/skeletor.org.ua\/?p=5987"},"modified":"2022-09-09T17:25:41","modified_gmt":"2022-09-09T14:25:41","slug":"%d0%b4%d0%b5%d1%8f%d0%ba%d1%96-%d1%85%d0%b8%d1%82%d1%80%d1%96-%d0%bc%d0%b5%d1%82%d0%be%d0%b4%d0%b8-%d0%b2%d0%b8%d0%b4%d0%b0%d0%bb%d0%b5%d0%bd%d0%bd%d1%8f-%d0%be%d1%87%d0%b8%d1%81%d1%82%d0%ba%d0%b8","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=5987","title":{"rendered":"\u0414\u0435\u044f\u043a\u0456 \u0445\u0438\u0442\u0440\u0456 \u043c\u0435\u0442\u043e\u0434\u0438 \u0432\u0438\u0434\u0430\u043b\u0435\u043d\u043d\u044f\/\u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0444\u0430\u0439\u043b\u0456\u0432"},"content":{"rendered":"\n<p>\u0422\u0443\u0442 \u0431\u0443\u0434\u0443\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0456 \u0434\u0435\u044f\u043a\u0456 \u043c\u0435\u0442\u043e\u0434\u0438, \u044f\u043a\u0456 \u043a\u0440\u0430\u0449\u0435 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 \u0443 <strong>HighLoad<\/strong>, \u0437\u0430\u043c\u0456\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0438\u0447\u043d\u0438\u0445, \u043e\u0441\u043a\u0456\u043b\u044c\u043a\u0438 \u0432\u043e\u043d\u0438 \u043c\u0435\u043d\u0448\u0435 \u043d\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0443\u044e\u0442\u044c \u041f\u0417.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#df720e\" class=\"has-inline-color\">truncate<\/mark><\/strong><\/li><\/ul>\n\n\n\n<p>\u0414\u043e\u0437\u0432\u043e\u043b\u044f\u0454 \u043e\u0431\u0440\u0456\u0437\u0430\u0442\u0438 \u0444\u0430\u0439\u043b \u0434\u043e \u0440\u043e\u0437\u043c\u0456\u0440\u0443, \u044f\u043a\u0438\u0439 \u0432\u043a\u0430\u0437\u0430\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043a\u043b\u0430\u0434, \u0434\u043e <strong>5Gb <\/strong>(\u0437\u0430\u0440\u0430\u0437 \u0444\u0430\u0439\u043b \u0437\u0430\u0439\u043c\u0430\u0454, \u043d\u0430\u043f\u0440\u0438\u043a\u043b\u0430\u0434, <strong>10Gb<\/strong>):<\/p>\n\n\n\n<p><code>$ truncate -s 5G file<\/code><\/p>\n\n\n\n<p><strong><em><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f60707\" class=\"has-inline-color\">\u0417\u0430\u0443\u0432\u0430\u0436\u0435\u043d\u043d\u044f<\/mark><\/em><\/strong>.<\/p>\n\n\n\n<p>\u0427\u0438\u043c \u0446\u0435\u0439 \u043c\u0435\u0442\u043e\u0434 \u043a\u0440\u0430\u0449\u0435, \u043d\u0456\u0436, <strong>echo > file<\/strong>. \u0422\u0438\u043c, \u0449\u043e echo \u0446\u0435 \u0440\u043e\u0431\u0438\u0442\u044c \u0434\u0443\u0436\u0435 \u0430\u0433\u0440\u0435\u0441\u0438\u0432\u043d\u043e \u0456 \u0434\u0443\u0436\u0435 \u043d\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0443\u0454 \u0434\u0438\u0441\u043a\u0438, \u0430 \u0442\u0430\u043a\u043e\u0436 \u0431\u043b\u043e\u043a\u0443\u0454 \u0444\u0430\u0439\u043b\u043e\u0432\u0438\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440. <strong>truncate <\/strong>\u043c\u043e\u0436\u043d\u0430 \u0432\u0438\u043a\u043e\u043d\u0443\u0432\u0430\u0442\u0438, \u043d\u0430\u043f\u0440\u0438\u043a\u043b\u0430\u0434, \u043f\u043e\u0454\u0442\u0430\u043f\u043d\u043e, \u0437\u0430 1 \u0440\u0430\u0437 &#8220;\u043e\u0431\u0440\u0456\u0437\u0430\u044e\u0447\u0438&#8221; \u043f\u043e <strong>1Gb<\/strong>, \u0430\u0431\u043e \u043c\u0435\u043d\u0448\u0435.<\/p>\n\n\n<p><!--more--><\/p>\n\n\n<ul class=\"wp-block-list\"><li><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#df720e\" class=\"has-inline-color\">ln (\u0441\u0430\u043c\u0435 hardlink)<\/mark><\/strong><\/li><\/ul>\n\n\n\n<p>\u0412 \u0434\u0430\u043d\u043e\u043c\u0443 \u0432\u0438\u043f\u0430\u0434\u043a\u0443 \u0441\u043f\u0440\u043e\u0431\u0443\u0454\u043c\u043e \u0437\u0440\u043e\u0431\u0438\u0442\u0438 <strong>drop table<\/strong> \u0432 <strong>mysql<\/strong>, \u0430\u043b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044f \u0437\u0430\u0439\u043c\u0430\u0454 <strong>100Gb<\/strong>. \u041f\u0440\u043e\u0441\u0442\u0438\u0439 <strong>drop <\/strong>table \u043c\u043e\u0436\u0435 &#8220;\u043f\u0456\u0434\u0432\u0456\u0441\u0438\u0442\u0438&#8221; \u0432\u0435\u0441\u044c <strong>mysql <\/strong>\u0437 \u0443\u0441\u0456\u043c\u0430 \u043d\u0430\u0441\u043b\u0456\u0434\u043a\u0430\u043c\u0438. \u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u043f\u0440\u043e\u043f\u043e\u043d\u0443\u0454\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u0438\u0439 \u0445\u0430\u043a:<\/p>\n\n\n<pre># cd \/database\/mysql\/big_db\n# ln large_table.ibd large_table.ibd.hardlink\nmysql&gt;drop table if exists big_db.large_table;\n# rm large_table.ibd.hardlink (or truncate -s &lt;&gt; large_table.ibd.hardlink)\n<\/pre>\n\n\n<p>\u0427\u043e\u043c\u0443 \u0446\u0435 \u0448\u0432\u0438\u0434\u043a\u043e? \u0422\u043e\u043c\u0443, \u0449\u043e \u0446\u0435 <strong>hardlink <\/strong>\u0456 \u043f\u043e \u0441\u0443\u0442\u0456 \u0432\u0438\u043a\u043e\u043d\u0443\u0454\u0442\u044c\u0441\u044f \u043b\u0438\u0448\u0435 <strong>unlink<\/strong>, \u043a\u043e\u043b\u0438 \u043c\u0438 \u0440\u043e\u0431\u0438\u043c\u043e <strong>drop table<\/strong> \u0431\u0435\u0437 \u0432\u0438\u0434\u0430\u043b\u0435\u043d\u043d\u044f \u0444\u0430\u043a\u0442\u0438\u0447\u043d\u0438\u0445 \u0434\u0430\u043d\u0438\u0445 (\u043e\u0441\u043a\u0456\u043b\u044c\u043a\u0438 \u0441\u0430\u043c\u0456 \u0434\u0430\u043d\u0456 \u0432\u0441\u0435 \u0449\u0435 \u043b\u0438\u0448\u0430\u044e\u0442\u044c\u0441\u044f \u0443 <strong>large_table.ibd.hardlink<\/strong>).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0422\u0443\u0442 \u0431\u0443\u0434\u0443\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0456 \u0434\u0435\u044f\u043a\u0456 \u043c\u0435\u0442\u043e\u0434\u0438, \u044f\u043a\u0456 \u043a\u0440\u0430\u0449\u0435 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 \u0443 HighLoad, \u0437\u0430\u043c\u0456\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0438\u0447\u043d\u0438\u0445, \u043e\u0441\u043a\u0456\u043b\u044c\u043a\u0438 \u0432\u043e\u043d\u0438 \u043c\u0435\u043d\u0448\u0435 \u043d\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0443\u044e\u0442\u044c \u041f\u0417. truncate \u0414\u043e\u0437\u0432\u043e\u043b\u044f\u0454 \u043e\u0431\u0440\u0456\u0437\u0430\u0442\u0438 \u0444\u0430\u0439\u043b \u0434\u043e \u0440\u043e\u0437\u043c\u0456\u0440\u0443, \u044f\u043a\u0438\u0439 \u0432\u043a\u0430\u0437\u0430\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043a\u043b\u0430\u0434, \u0434\u043e 5Gb (\u0437\u0430\u0440\u0430\u0437 \u0444\u0430\u0439\u043b \u0437\u0430\u0439\u043c\u0430\u0454, \u043d\u0430\u043f\u0440\u0438\u043a\u043b\u0430\u0434, 10Gb): $ truncate -s 5G file \u0417\u0430\u0443\u0432\u0430\u0436\u0435\u043d\u043d\u044f. \u0427\u0438\u043c \u0446\u0435\u0439 \u043c\u0435\u0442\u043e\u0434 \u043a\u0440\u0430\u0449\u0435, \u043d\u0456\u0436, echo > file. \u0422\u0438\u043c, \u0449\u043e echo \u0446\u0435 \u0440\u043e\u0431\u0438\u0442\u044c \u0434\u0443\u0436\u0435 \u0430\u0433\u0440\u0435\u0441\u0438\u0432\u043d\u043e \u0456 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,10],"tags":[],"class_list":["post-5987","post","type-post","status-publish","format-standard","hentry","category-databases","category-others"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5987","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5987"}],"version-history":[{"count":1,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5987\/revisions"}],"predecessor-version":[{"id":5988,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5987\/revisions\/5988"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5987"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5987"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5987"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}