Documentation Home
MySQL 9.4 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 41.2Mb
PDF (A4) - 41.3Mb
Man Pages (TGZ) - 262.8Kb
Man Pages (Zip) - 368.8Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


10.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) arenot 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 usingInnoDB tables and have run out of room in anInnoDB tablespace file. The maximum tablespace size is also the maximum size for a table. For tablespace size limits, seeSection 17.21, “InnoDB Limits”.

    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 usingMyISAM 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 aMyISAM 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 (2567 − 1 bytes).

    If you need aMyISAM table that is larger than the default limit and your operating system supports large files, theCREATE TABLE statement supportsAVG_ROW_LENGTH andMAX_ROWS options. SeeSection 15.1.24, “CREATE TABLE Statement”. 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 withALTER TABLE to increase a table's maximum permissible size. SeeSection 15.1.11, “ALTER TABLE Statement”.

    ALTER TABLEtbl_name MAX_ROWS=1000000000 AVG_ROW_LENGTH=nnn;

    You have to specifyAVG_ROW_LENGTH only for tables withBLOB orTEXT columns; in this case, MySQL cannot optimize the space required based only on the number of rows.

    To change the default size limit forMyISAM tables, set themyisam_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 theMAX_ROWS option. The value ofmyisam_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, seeSection 18.2.3, “MyISAM Table Storage Formats”.

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

    SHOW TABLE STATUS FROMdb_name LIKE 'tbl_name';

    You also can usemyisamchk -dv /path/to/table-index-file. SeeSection 15.7.7, “SHOW Statements”, orSection 6.6.4, “myisamchk — MyISAM Table-Maintenance Utility”.

    Other ways to work around file-size limits forMyISAM tables are as follows:

  • You are using theMEMORY (HEAP) storage engine; in this case you need to increase the value of themax_heap_table_size system variable. SeeSection 7.1.8, “Server System Variables”.