{"id":1141,"date":"2025-12-22T09:53:52","date_gmt":"2025-12-22T08:53:52","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=1141"},"modified":"2026-05-21T00:00:17","modified_gmt":"2026-05-20T22:00:17","slug":"why-is-the-size-of-the-sql-database-different-after-exporting-to-a-file-than-on-the-server","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/en\/knowledgebase\/why-is-the-size-of-the-sql-database-different-after-exporting-to-a-file-than-on-the-server\/","title":{"rendered":"Why is the size of the SQL database different after exporting to a file than on the server?"},"content":{"rendered":"\n<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">When administering a website or application on <strong>mybox<\/strong>, downloading a database backup often reveals a confusing technical quirk: <strong>the downloaded <code>.sql<\/code> file is significantly smaller than the database size displayed in your hosting panel<\/strong>, even if you didn\u2019t compress it into a <code>.zip<\/code> or <code>.gz<\/code> file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This difference is completely normal and represents a fundamental operational reality of how Relational Database Management Systems (RDBMS) like MySQL or MariaDB store data live on a server versus how they represent it in a file.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/why-is-the-size-of-the-sql-database-different-after-exporting-to-a-file-than-on-the-server\/#1_Overhead_and_Allocated_Free_Space_Unused_Slack_Space\" >1. Overhead and Allocated Free Space (Unused Slack Space)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/why-is-the-size-of-the-sql-database-different-after-exporting-to-a-file-than-on-the-server\/#2_Binary_vs_Plain_Text_Representation\" >2. Binary vs. Plain Text Representation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/why-is-the-size-of-the-sql-database-different-after-exporting-to-a-file-than-on-the-server\/#3_Indices_are_Outlined_Not_Stored\" >3. Indices are Outlined, Not Stored<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/why-is-the-size-of-the-sql-database-different-after-exporting-to-a-file-than-on-the-server\/#Comparison_Matrix\" >Comparison Matrix<\/a><\/li><\/ul><\/nav><\/div>\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Overhead_and_Allocated_Free_Space_Unused_Slack_Space\"><\/span>1. Overhead and Allocated Free Space (Unused Slack Space)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<\/div>\n\n<div id=\"mybox-3054072985\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Early access<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Still need help?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contact our customer service team.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Message us<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">Live databases are designed for speed, which means they prioritize quick data insertion over tight space saving.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The Server Reality:<\/strong> When data is deleted or modified on your <strong>mybox<\/strong> server, the database system doesn\u2019t instantly shrink the physical file on the disk (doing so is highly resource-intensive). Instead, it leaves those sectors empty, creating &#8220;holes&#8221; or unallocated free space marked for future write operations.<\/li>\n\n\n\n<li><strong>The Export Reality:<\/strong> When you trigger an export (a database dump), the system only reads the <em>active<\/em> data rows. The empty, pre-allocated spaces and internal overhead are stripped away, instantly dropping the file size.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Binary_vs_Plain_Text_Representation\"><\/span>2. Binary vs. Plain Text Representation<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The format of a live database is drastically different from a backed-up script.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Binary Storage (On Server):<\/strong> On your server, data is written in a highly complex binary format (such as InnoDB <code>.ibd<\/code> files). This includes page layouts, system tablespaces, row tracking IDs, and transaction logs.<\/li>\n\n\n\n<li><strong>Text Script (Exported File):<\/strong> A <code>.sql<\/code> file is just a plain, flat text file. It contains human-readable string commands like <code>CREATE TABLE<\/code> and <code>INSERT INTO<\/code>. It completely disces the heavy binary storage wrappers.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Indices_are_Outlined_Not_Stored\"><\/span>3. Indices are Outlined, Not Stored<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Indexes are a mechanical necessity for keeping search queries fast, but they take up substantial room.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>On the Server:<\/strong> Indexes are fully compiled, raw binary trees cached on the disk to map out where data sits. For complex application tables, <strong>indexes can easily take up 30\u201350% of the total server space<\/strong>.<\/li>\n\n\n\n<li><strong>In the Exported File:<\/strong> The export tool does not save the structural map of the index. Instead, it writes a single text line detailing how to rebuild it:SQL<code>ALTER TABLE `wp_posts` ADD KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`); <\/code>When you eventually import this file onto a new database, the server reads that single instruction line and builds the heavy indexes from scratch.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Comparison_Matrix\"><\/span>Comparison Matrix<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td><strong>Technical Component<\/strong><\/td><td><strong>Included on the Live Server?<\/strong><\/td><td><strong>Included in the Raw .sql Export?<\/strong><\/td><\/tr><\/thead><tbody><tr><td><strong>Actual Row Data<\/strong><\/td><td>Yes (Binary format)<\/td><td>Yes (Plain Text format)<\/td><\/tr><tr><td><strong>Temporary\/Transaction Logs<\/strong><\/td><td>Yes (Saves states for crashes)<\/td><td>No (Completely omitted)<\/td><\/tr><tr><td><strong>Unused\/Deleted Row Blocks<\/strong><\/td><td>Yes (Kept as free space buffers)<\/td><td>No (Skipped entirely)<\/td><\/tr><tr><td><strong>Compiled Indexes<\/strong><\/td><td>Yes (Heavy lookup trees)<\/td><td>No (Only saved as a recreation rule)<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[9,25],"manual_kb_tag":[390,391,392,393,394,395,396,397,388,389],"class_list":["post-1141","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-databases","manualknowledgebasecat-hosting","manual_kb_tag-database-dump","manual_kb_tag-export-file-size","manual_kb_tag-database-size","manual_kb_tag-file-structure","manual_kb_tag-metadata-impact","manual_kb_tag-transaction-logs","manual_kb_tag-temporary-tables","manual_kb_tag-index-size","manual_kb_tag-database-export","manual_kb_tag-database-backup"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/1141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/1141\/revisions"}],"predecessor-version":[{"id":8341,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/1141\/revisions\/8341"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/media?parent=1141"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manualknowledgebasecat?post=1141"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb_tag?post=1141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}