{"id":2562,"date":"2016-06-28T08:57:48","date_gmt":"2016-06-28T08:57:48","guid":{"rendered":"http:\/\/blog.designed79.co.uk\/?p=2562"},"modified":"2016-06-28T08:58:34","modified_gmt":"2016-06-28T08:58:34","slug":"mysql-myisamchk-error-myisam_sort_buffer_size-is-too-small","status":"publish","type":"post","link":"https:\/\/blog.designed79.co.uk\/?p=2562","title":{"rendered":"MySQL \u2013 myisamchk: error: myisam_sort_buffer_size is too small"},"content":{"rendered":"<p>If you&#8217;re trying to repair large MyISAM tables in MySQL, you can run into the following restriction, because of the limited size of the default Sort Buffer.<\/p>\n<pre>srv # myisamchk -r table.MYI\r\n- recovering (with sort) MyISAM-table 'table.MYI'\r\nData records: 335045\r\n- Fixing index 1\r\nFound block that points outside data file at 1509428340\r\nFound link that points at 61778810452273 (outside data file) at 1509428348\r\n- Fixing index 2\r\n- Fixing index 3\r\n- Fixing index 4\r\n- Fixing index 5\r\n- Fixing index 6\r\n- Fixing index 7\r\n- Fixing index 8\r\nmyisamchk: error: myisam_sort_buffer_size is too small\r\nMyISAM-table 'table.MYI' is not fixed because of errors<\/pre>\n<p>While the fix seems obvious (increase the myisam_sort_buffer_size), it&#8217;s a bit confusing.<\/p>\n<p>The MySQL server knows 2 variables, myisam_sort_buffer_size and sort_buffer_size. The first one is the one used for the buffer in &#8220;Repair by sort&#8221;. The second one is used to buffer a filesort.<\/p>\n<p>The myisamchk command does not have myisam_sort_buffer_size. myisamchk has only sort_buffer_size, which is used for &#8220;Repair by sort&#8221;.<\/p>\n<p>The following increases the buffer size.<\/p>\n<pre>srv # myisamchk -r -q table.MYI --sort_buffer_size=2G<\/pre>\n<p>Or increase the memory, if it&#8217;s still not sufficient to do the repair.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re trying to repair large MyISAM tables in MySQL, you can run into the following restriction, because of the limited size [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2562","post","type-post","status-publish","format-standard","hentry","category-info-on-tech"],"_links":{"self":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2562"}],"version-history":[{"count":0,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2562\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}