{"id":1159,"date":"2010-11-23T09:06:13","date_gmt":"2010-11-23T13:06:13","guid":{"rendered":"http:\/\/linuxhostingsupport.net\/blog\/?p=1159"},"modified":"2013-03-20T08:43:57","modified_gmt":"2013-03-20T12:43:57","slug":"how-to-defragment-or-optimize-a-database-in-mysql","status":"publish","type":"post","link":"https:\/\/linuxhostingsupport.net\/blog\/how-to-defragment-or-optimize-a-database-in-mysql","title":{"rendered":"How to defragment or optimize a database in Mysql?"},"content":{"rendered":"<p>In case you remove a lot of data from the tables OR change the database structure, a de-fragmentation\/optimizing of the database is necessary to avoid performance loss, especially while running queries. To avoid performance loss, optimize the database.<\/p>\n<p>SSH to your server and execute:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\">mysqlcheck -o &lt;databasename&gt;<\/span><\/pre>\n<\/blockquote>\n<p>where, <strong>-o stands for optimize<\/strong> which is similar to defragmentation. You should look to defragment the tables regularly when using VARCHAR fields since these columns get fragmented too often.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In case you remove a lot of data from the tables OR change the database structure, a de-fragmentation\/optimizing of the database is necessary to avoid performance loss, especially while running queries. To avoid performance loss, optimize the database.<br \/>\nSSH to your server and execute:<\/p>\n<p>mysqlcheck -o &lt;databasename&gt;<\/p>\n<p>where, -o stands for optimize which is similar to defragmentation. You should look to defragment the tables regularly when using VARCHAR fields since these columns get fragmented too often.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[111],"tags":[1119,1116,1118,1117],"_links":{"self":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1159"}],"collection":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/comments?post=1159"}],"version-history":[{"count":5,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1159\/revisions"}],"predecessor-version":[{"id":2273,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1159\/revisions\/2273"}],"wp:attachment":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/media?parent=1159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/categories?post=1159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/tags?post=1159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}