MySQL: What is a page?

后端 未结 3 886
花落未央
花落未央 2021-01-30 05:28

I can\'t for the life of me remember what a page is, in the context of a MySQL database. When I see something like 8KB/page, does that mean 8KB per row or ...?

3条回答
  •  深忆病人
    2021-01-30 05:49

    Database pages are the internal basic structure to organize the data in the database files. Following, some information about the InnoDB model:

    From 13.2.11.2. File Space Management:

    The data files that you define in the configuration file form the InnoDB tablespace. The files are logically concatenated to form the tablespace. [...] The tablespace consists of database pages with a default size of 16KB. The pages are grouped into extents of size 1MB (64 consecutive pages). The “files” inside a tablespace are called segments in InnoDB.

    And from 13.2.14. Restrictions on InnoDB Tables

    The default database page size in InnoDB is 16KB. By recompiling the code, you can set it to values ranging from 8KB to 64KB.

    Further, to put rows in relation to pages:

    The maximum row length, except for variable-length columns (VARBINARY, VARCHAR, BLOB and TEXT), is slightly less than half of a database page. That is, the maximum row length is about 8000 bytes. LONGBLOB and LONGTEXT columns must be less than 4GB, and the total row length, including BLOB and TEXT columns, must be less than 4GB.

提交回复
热议问题