### 8.4.6 Limits on Table Size

[]()[]()[]()[]()[]()[]()[]()

 The effective maximum table size for MySQL databases is usually determined by operating system constraints on file sizes, not by MySQL internal limits. For up-to-date information operating system file size limits, refer to the documentation specific to your operating system.

 Windows users, please note that FAT and VFAT (FAT32) are *not* considered suitable for production use with MySQL. Use NTFS instead.

 If you encounter a full-table error, there are several reasons why it might have occurred:

* The disk might be full.

* You are using `InnoDB` tables and have run out of room in an `InnoDB` tablespace file. The maximum tablespace size is also the maximum size for a table. For tablespace size limits, see [Section 15.22, “InnoDB Limits”](innodb-limits.html).

   Generally, partitioning of tables into multiple tablespace files is recommended for tables larger than 1TB in size.

* You have hit an operating system file size limit. For example, you are using `MyISAM` tables on an operating system that supports files only up to 2GB in size and you have hit this limit for the data file or index file.

* You are using a `MyISAM` table and the space required for the table exceeds what is permitted by the internal pointer size. `MyISAM` permits data and index files to grow up to 256TB by default, but this limit can be changed up to the maximum permissible size of 65,536TB (256<sup>7</sup> − 1 bytes).

   If you need a `MyISAM` table that is larger than the default limit and your operating system supports large files, the [`CREATE TABLE`](create-table.html) statement supports `AVG_ROW_LENGTH` and `MAX_ROWS` options. See [Section 13.1.20, “CREATE TABLE Statement”](create-table.html). The server uses these options to determine how large a table to permit.

   If the pointer size is too small for an existing table, you can change the options with [`ALTER TABLE`](alter-table.html) to increase a table's maximum permissible size. See [Section 13.1.9, “ALTER TABLE Statement”](alter-table.html).

  ```
  ALTER TABLE tbl_name MAX_ROWS=1000000000 AVG_ROW_LENGTH=nnn;
  ```

   You have to specify `AVG_ROW_LENGTH` only for tables with [`BLOB`](blob.html) or [`TEXT`](blob.html) columns; in this case, MySQL cannot optimize the space required based only on the number of rows.

   To change the default size limit for `MyISAM` tables, set the [`myisam_data_pointer_size`](server-system-variables.html#sysvar_myisam_data_pointer_size), which sets the number of bytes used for internal row pointers. The value is used to set the pointer size for new tables if you do not specify the `MAX_ROWS` option. The value of [`myisam_data_pointer_size`](server-system-variables.html#sysvar_myisam_data_pointer_size) can be from 2 to 7. For example, for tables that use the dynamic storage format, a value of 4 permits tables up to 4GB; a value of 6 permits tables up to 256TB. Tables that use the fixed storage format have a larger maximum data length. For storage format characteristics, see [Section 16.2.3, “MyISAM Table Storage Formats”](myisam-table-formats.html).

   You can check the maximum data and index sizes by using this statement:

  ```
  SHOW TABLE STATUS FROM db_name LIKE 'tbl_name';
  ```

   You also can use [**myisamchk -dv /path/to/table-index-file**](myisamchk.html). See [Section 13.7.7, “SHOW Statements”](show.html), or [Section 4.6.4, “myisamchk — MyISAM Table-Maintenance Utility”](myisamchk.html).

   Other ways to work around file-size limits for `MyISAM` tables are as follows:

  * If your large table is read only, you can use [**myisampack**](myisampack.html) to compress it. [**myisampack**](myisampack.html) usually compresses a table by at least 50%, so you can have, in effect, much bigger tables. [**myisampack**](myisampack.html) also can merge multiple tables into a single table. See [Section 4.6.6, “myisampack — Generate Compressed, Read-Only MyISAM Tables”](myisampack.html).

  * MySQL includes a `MERGE` library that enables you to handle a collection of `MyISAM` tables that have identical structure as a single `MERGE` table. See [Section 16.7, “The MERGE Storage Engine”](merge-storage-engine.html).

* You are using the `MEMORY` (`HEAP`) storage engine; in this case you need to increase the value of the [`max_heap_table_size`](server-system-variables.html#sysvar_max_heap_table_size) system variable. See [Section 5.1.8, “Server System Variables”](server-system-variables.html).

