Home  >  Article  >  Database  >  How many rows can a MySQL table have at most?

How many rows can a MySQL table have at most?

下次还敢
下次还敢Original
2024-04-22 19:46:07562browse

The maximum number of rows for a MySQL table depends on the storage engine: InnoDB: 64 KB, adjustable to 8 KBMyISAM: 64 KB, adjustable to 4 GB Other storage engines: limit from a few hundred bytes to a few GB No wait.

How many rows can a MySQL table have at most?

Maximum number of rows in a MySQL table

The maximum number of rows in a MySQL table depends on the Storage engine. Different storage engines have different row size limits, and they can also be adjusted through configuration.

InnoDB

InnoDB is the default storage engine in MySQL and has the following row size limit:

  • 64 KB default maximum row size
  • can be adjusted to Compact or Redundant through the innodb_row_format setting, up to 8 KB

MyISAM

MyISAM is another popular storage engine that has the following row size limit:

  • 64 KB Default maximum row size
  • Can Adjustable by the myisam_max_row_size setting, up to 4 GB

Other storage engines

Other storage engines such as Memory, CSV and Blackhole ) also has its own row size limit, ranging from a few hundred bytes to several gigabytes.

Configuring row size limits

You can adjust the row size limit of the storage engine as follows:

For InnoDB:

<code class="sql">ALTER TABLE table_name ROW_FORMAT=Compact;</code>

For MyISAM:

<code class="sql">ALTER TABLE table_name MAX_ROWSIZE=8388608;</code>

Notes

  • The row size limit includes data, indexes, and any other stored information.
  • Rows that exceed the row size limit will not be inserted into the table.
  • Larger row sizes increase storage space usage and may affect performance.
  • It is very important to choose an appropriate row size limit based on the actual needs of the table.

The above is the detailed content of How many rows can a MySQL table have at most?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn