The effective maximum table size for MySQL databases is usually determined by operating system constraints on file sizes, not by MySQL internal limits. MySQL数据库的有效最大表大小通常由操作系统对文件大小的限制决定,而不是由MySQL内部限制决定。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. Windows用户,请注意FAT和VFAT(FAT32)不适用于MySQL的生产使用。Use NTFS instead.请改用NTFS。
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. InnoDB表,并且InnoDB表空间文件中的空间不足。The maximum tablespace size is also the maximum size for a table. 最大表空间大小也是表的最大大小。For tablespace size limits, see Section 15.22, “InnoDB Limits”.有关表空间大小限制,请参阅第15.22节,“InnoDB限制”。
Generally, partitioning of tables into multiple tablespace files is recommended for tables larger than 1TB in size.通常,对于大小大于1TB的表,建议将表划分为多个表空间文件。
You have hit an operating system file size limit. For example, you are using 您已达到操作系统文件大小限制。例如,在一个只支持2GB大小文件的操作系统上使用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.MyISAM表,并且数据文件或索引文件达到了这个限制。
You are using a 您正在使用MyISAM table and the space required for the table exceeds what is permitted by the internal pointer size. MyISAM表,该表所需的空间超出了内部指针大小允许的范围。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).MyISAM允许数据和索引文件在默认情况下增长到256TB,但此限制可以更改为最大允许大小65536TB(2567 1字节)。
If you need a 如果需要大于默认限制的MyISAM table that is larger than the default limit and your operating system supports large files, the CREATE TABLE statement supports AVG_ROW_LENGTH and MAX_ROWS options. MyISAM表,并且操作系统支持大文件,则CREATE TABLE语句支持AVG_ROW_LENGTH和MAX_ROWS选项。See Section 13.1.20, “CREATE TABLE Statement”. 请参阅第13.1.20节,“CREATE TABLE语句”。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 to increase a table's maximum permissible size. ALTER TABLE更改选项以增加表的最大允许大小。See Section 13.1.9, “ALTER TABLE Statement”.请参阅第13.1.9节,“ALTER TABLE语句”。
ALTER TABLEtbl_nameMAX_ROWS=1000000000 AVG_ROW_LENGTH=nnn;
You have to specify 必须仅为具有AVG_ROW_LENGTH only for tables with BLOB or TEXT columns; in this case, MySQL cannot optimize the space required based only on the number of rows.BLOB或TEXT列的表指定AVG_ROW_LENGTH;在这种情况下,MySQL无法仅根据行数优化所需的空间。
To change the default size limit for 要更改MyISAM tables, set the myisam_data_pointer_size, which sets the number of bytes used for internal row pointers. MyISAM表的默认大小限制,请设置myisam_data_pointer_size,它设置用于内部行指针的字节数。The value is used to set the pointer size for new tables if you do not specify the 如果未指定MAX_ROWS option. MAX_ROWS选项,则该值用于设置新表的指针大小。The value of myisam_data_pointer_size can be from 2 to 7. myisam_data_pointer_size的值可以是2到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. 例如,对于使用动态存储格式的表,值4允许最多4GB的表;值为6时,表的最大容量为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”.有关存储格式特征,请参阅第16.2.3节,“MyISAM表格存储格式”。
You can check the maximum data and index sizes by using this statement:您可以使用以下语句检查最大数据和索引大小:
SHOW TABLE STATUS FROMdb_nameLIKE 'tbl_name';
You also can use myisamchk -dv /path/to/table-index-file. 您还可以使用myisamchk -dv /path/to/table-index-file。See Section 13.7.7, “SHOW Statements”, or Section 4.6.4, “myisamchk — MyISAM Table-Maintenance Utility”.请参阅第13.7.7节,“SHOW语句”或第4.6.4节,“myisamchk-MyISAM表格维护实用程序”。
Other ways to work around file-size limits for 解决MyISAM tables are as follows:MyISAM表文件大小限制的其他方法如下:
If your large table is read only, you can use myisampack to compress it. 如果你的大表是只读的,你可以用myisampack来压缩它。myisampack usually compresses a table by at least 50%, so you can have, in effect, much bigger tables. myisampack通常会将一张表压缩至少50%,所以实际上你可以拥有更大的表。myisampack also can merge multiple tables into a single table. myisampack还可以将多个表合并到一个表中。See Section 4.6.6, “myisampack — Generate Compressed, Read-Only MyISAM Tables”.请参阅第4.6.6节,“myisampack-生成压缩的只读MyISAM表”。
MySQL includes a MySQL包含一个MERGE library that enables you to handle a collection of MyISAM tables that have identical structure as a single MERGE table. MERGE库,使您能够处理与单个MERGE表具有相同结构的MyISAM表集合。See Section 16.7, “The MERGE Storage Engine”.请参阅第16.7节,“合并存储引擎”。
You are using the 您正在使用MEMORY (HEAP) storage engine; in this case you need to increase the value of the max_heap_table_size system variable. MEMORY(HEAP)存储引擎;在这种情况下,需要增加max_heap_table_size系统变量的值。See Section 5.1.8, “Server System Variables”.请参阅第5.1.8节,“服务器系统变量”。