{"id":12442,"date":"2023-11-20T18:46:06","date_gmt":"2023-11-21T01:46:06","guid":{"rendered":"https:\/\/www.mysqltutorial.org\/?page_id=12442"},"modified":"2023-12-21T20:20:07","modified_gmt":"2023-12-22T03:20:07","slug":"mysql-optimize-table","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-optimize-table\/","title":{"rendered":"MySQL OPTIMIZE TABLE Statement"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to use the MySQL <code>OPTIMIZE TABLE<\/code> statement to improve the performance of the database.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to MySQL OPTIMIZE TABLE statement<\/h2>\n\n\n\n<p>The <code>OPTIMIZE<\/code> <code>TABLE<\/code> statement allows you to reorganize the physical storage of table data to reclaim unused storage space and improve performance when accessing the table.<\/p>\n\n\n\n<p>In practice, you&#8217;ll find the <code>OPTIMIZE TABLE<\/code> statement useful in the following cases:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Frequent deletions\/updates: If a table has frequent <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-update\/\">updates<\/a> or deletions, its data may be fragmented. The <code>OPTIMIZE TABLE<\/code> statement can help rearrange the storage structure and eliminate wasted space.<\/li>\n\n\n\n<li>Table with variable-length rows: Tables with variable-length data such as <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-varchar\/\">VARCHAR<\/a><\/code>, <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-text\/\">TEXT<\/a><\/code>, and <code>BLOB<\/code> may become fragmented over time. By using the <code>OPTIMIZE TABLE<\/code> statement, you can reduce the storage overhead.<\/li>\n\n\n\n<li>Significant data growth and shrinkage: If your database experiences significant growth &amp; shrinkage, you can run the <code>OPTIMIZE TABLE<\/code> periodically to maintain optimal storage efficiency.<\/li>\n<\/ul>\n\n\n\n<p>Overall, using the <code>OPTIMIZE TABLE<\/code> statement helps you optimize the storage space of table data and improve the query performance.<\/p>\n\n\n\n<p>The <code>OPTIMIZE TABLE<\/code> statement works with InnoDB, MyISAM, and ARCHIVE tables. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">MySQL OPTIMIZE TABLE statement examples<\/h2>\n\n\n\n<p>Let&#8217;s take some examples of using the MySQL <code>OPTIMIZE TABLE<\/code> statement.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1) Using the MySQL OPTIMIZE TABLE statement for MyISAM tables<\/h3>\n\n\n\n<p>For MyISAM tables, the <code>OPTIMIZE TABLE<\/code> statement works as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Repair the table if it has deleted or split rows.<\/li>\n\n\n\n<li>Sort the index pages if they are not sorted.<\/li>\n\n\n\n<li>Update the table statistics if they are not up to date.<\/li>\n<\/ul>\n\n\n\n<p>The following example illustrates the steps for optimizing a MyISAM table:<\/p>\n\n\n\n<p>First, check the table status using the <code>show table status<\/code> statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SHOW<\/span> <span class=\"hljs-keyword\">TABLE<\/span> <span class=\"hljs-keyword\">STATUS<\/span> <span class=\"hljs-keyword\">LIKE<\/span> <span class=\"hljs-string\">'&lt;table_name&gt;'<\/span>\\G<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>It&#8217;ll return the output like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">*************************** 1. row ***************************\n           Name: &lt;table_name&gt;\n         Engine: MyISAM\n        Version: 10\n     Row_format: Dynamic\n           Rows: 5000\n Avg_row_length: 44\n    Data_length: 440000\nMax_data_length: 281474976710655\n   Index_length: 105472\n      Data_free: 220000\n Auto_increment: 10001\n    Create_time: 2023-11-21 07:34:39\n    Update_time: 2023-11-21 07:38:43\n     Check_time: NULL\n      Collation: utf8mb4_0900_ai_ci\n       <span class=\"hljs-keyword\">Checksum<\/span>: <span class=\"hljs-literal\">NULL<\/span>\n Create_options:\n        <span class=\"hljs-keyword\">Comment<\/span>:\n<span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">row<\/span> <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">set<\/span> (<span class=\"hljs-number\">0.00<\/span> sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>There are two important columns in the output regarding optimizing the table:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <code>Data_length<\/code> represents the space used by all rows in the table including any overhead as row headers. <\/li>\n\n\n\n<li>The <code>Data_free<\/code> is the amount of free space (in bytes) in the data file. It indicates how much space can potentially be reclaimed by the <code>OPTIMIZE TABLE<\/code> statement.<\/li>\n<\/ul>\n\n\n\n<p> Second, optimize the table using the <code>OPTIMIZE TABLE<\/code> statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">OPTIMIZE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> &lt;table_name&gt;;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">+<span class=\"hljs-comment\">----------------+----------+----------+----------+<\/span>\n| Table          | Op       | Msg_type | Msg_text |\n+<span class=\"hljs-comment\">----------------+----------+----------+----------+<\/span>\n| test.text_data | <span class=\"hljs-keyword\">optimize<\/span> | <span class=\"hljs-keyword\">status<\/span>   | OK       |\n+<span class=\"hljs-comment\">----------------+----------+----------+----------+<\/span>\n<span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">row<\/span> <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">set<\/span> (<span class=\"hljs-number\">0.05<\/span> sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>Msg_text<\/code> is <code>OK<\/code> which indicates the optimization is successful.<\/p>\n\n\n\n<p>Third, check the status of the table again:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SHOW<\/span> <span class=\"hljs-keyword\">TABLE<\/span> <span class=\"hljs-keyword\">STATUS<\/span> <span class=\"hljs-keyword\">LIKE<\/span> <span class=\"hljs-string\">'&lt;table_name&gt;'<\/span>\\G<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If the table space is fragmented, you&#8217;ll see <code>Data_free<\/code> is zero:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">*************************** 1. row ***************************\n           Name: &lt;table_name&gt;\n         Engine: MyISAM\n        Version: 10\n     Row_format: Dynamic\n           Rows: 5000\n Avg_row_length: 44\n    Data_length: 440000\nMax_data_length: 281474976710655\n   Index_length: 105472\n      Data_free: 0\n Auto_increment: 10001\n    Create_time: 2023-11-21 08:03:12\n    Update_time: 2023-11-21 08:03:41\n     Check_time: NULL\n      Collation: utf8mb4_0900_ai_ci\n       <span class=\"hljs-keyword\">Checksum<\/span>: <span class=\"hljs-literal\">NULL<\/span>\n Create_options:\n        <span class=\"hljs-keyword\">Comment<\/span>:\n<span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">row<\/span> <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">set<\/span> (<span class=\"hljs-number\">0.00<\/span> sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\">2) Using the MySQL OPTIMIZE TABLE statement for InnoDB tables<\/h3>\n\n\n\n<p>When you run the <code>OPTIMIZE TABLE<\/code> statement on <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-innodb-storage-engine\/\">InnoDB<\/a><\/code> tables, you&#8217;ll get the following output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">+<span class=\"hljs-comment\">--------+----------+----------+-------------------------------------------------------------------+<\/span>\n| Table  | Op       | Msg_type | Msg_text                                                          |\n+<span class=\"hljs-comment\">--------+----------+----------+-------------------------------------------------------------------+<\/span>\n| test.t | <span class=\"hljs-keyword\">optimize<\/span> | note     | <span class=\"hljs-keyword\">Table<\/span> does <span class=\"hljs-keyword\">not<\/span> support <span class=\"hljs-keyword\">optimize<\/span>, doing recreate + <span class=\"hljs-keyword\">analyze<\/span> instead |\n| test.t | <span class=\"hljs-keyword\">optimize<\/span> | <span class=\"hljs-keyword\">status<\/span>   | OK                                                                |\n+<span class=\"hljs-comment\">--------+----------+----------+-------------------------------------------------------------------+<\/span>\n<span class=\"hljs-number\">2<\/span> <span class=\"hljs-keyword\">rows<\/span> <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">set<\/span> (<span class=\"hljs-number\">0.05<\/span> sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The first message:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">Table does not support <span class=\"hljs-keyword\">optimize<\/span>, doing recreate + <span class=\"hljs-keyword\">analyze<\/span> instead<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>It means that the <code>OPTIMIZE<\/code> <code>TABLE<\/code> does not optimize the <code>InnoDB<\/code> tables in the same way it optimizes the MyISAM tables. Instead, the <code>OPTIMIZE<\/code> <code>TABLE<\/code> statement performs the following actions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, create a new empty table.<\/li>\n\n\n\n<li>Second, copy all rows from the original table into the new table.<\/li>\n\n\n\n<li>Third, <a href=\"https:\/\/www.mysqltutorial.org\/mysql-drop-table\">delete the original table<\/a> and rename the new tables.<\/li>\n\n\n\n<li>Finally, run the <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-analyze-table\/\">ANALYZE<\/a><\/code> statement to gather table statistics.<\/li>\n<\/ul>\n\n\n\n<p>One caution is that you should avoid running the <code>OPTIMIZE<\/code> <code>TABLE<\/code> statement on a large <code>InnoDB<\/code> table when the disk space is low, as it is likely to cause the server to run out of space while attempting to recreate the large table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the <code>OPTIMIZE<\/code> <code>TABLE<\/code> statement to reorganize the physical storage of tables to reduce disk space usage and improve query execution time.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful? <\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"12442\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-optimize-table\/\"\n\t\t\t\tdata-post-title=\"MySQL OPTIMIZE TABLE Statement\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"12442\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-optimize-table\/\"\n\t\t\t\tdata-post-title=\"MySQL OPTIMIZE TABLE Statement\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to use the MySQL OPTIMIZE TABLE statement to improve the performance of the database<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":441,"menu_order":56,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-12442","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL OPTIMIZE TABLE Statement<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn how to use the MySQL OPTIMIZE TABLE statement to improve the performance of the database\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-optimize-table\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL OPTIMIZE TABLE Statement\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to use the MySQL OPTIMIZE TABLE statement to improve the performance of the database\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-optimize-table\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-22T03:20:07+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-administration\\\/mysql-optimize-table\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-administration\\\/mysql-optimize-table\\\/\",\"name\":\"MySQL OPTIMIZE TABLE Statement\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"datePublished\":\"2023-11-21T01:46:06+00:00\",\"dateModified\":\"2023-12-22T03:20:07+00:00\",\"description\":\"In this tutorial, you will learn how to use the MySQL OPTIMIZE TABLE statement to improve the performance of the database\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-administration\\\/mysql-optimize-table\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-administration\\\/mysql-optimize-table\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-administration\\\/mysql-optimize-table\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL Administration\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-administration\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"MySQL OPTIMIZE TABLE Statement\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL OPTIMIZE TABLE Statement","description":"In this tutorial, you will learn how to use the MySQL OPTIMIZE TABLE statement to improve the performance of the database","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-optimize-table\/","og_locale":"en_US","og_type":"article","og_title":"MySQL OPTIMIZE TABLE Statement","og_description":"In this tutorial, you will learn how to use the MySQL OPTIMIZE TABLE statement to improve the performance of the database","og_url":"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-optimize-table\/","og_site_name":"MySQL Tutorial","article_modified_time":"2023-12-22T03:20:07+00:00","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-optimize-table\/","url":"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-optimize-table\/","name":"MySQL OPTIMIZE TABLE Statement","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"datePublished":"2023-11-21T01:46:06+00:00","dateModified":"2023-12-22T03:20:07+00:00","description":"In this tutorial, you will learn how to use the MySQL OPTIMIZE TABLE statement to improve the performance of the database","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-optimize-table\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-optimize-table\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-optimize-table\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL Administration","item":"https:\/\/www.mysqltutorial.org\/mysql-administration\/"},{"@type":"ListItem","position":3,"name":"MySQL OPTIMIZE TABLE Statement"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/12442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=12442"}],"version-history":[{"count":5,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/12442\/revisions"}],"predecessor-version":[{"id":13408,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/12442\/revisions\/13408"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/441"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=12442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}