• notice
  • Congratulations on the launch of the Sought Tech site

Modify the data page size of InnoDB to optimize the mysql method

We know that the data page of Innodb is 16K, and it is a rigid rule.There is no way to change it in the system.We hope that in the future, it will also support multiple data page sizes like Oracle.
However, in practical applications, 16K is sometimes a bit large, especially when many businesses migrate to MySQL when Oracle or SQL SERVER is running well and find that the IO growth is too obvious,
Will think of changing the data page size.
In fact, the data page size of innodb can also be changed, but it needs to be changed at the source code layer, and then rebuild MySQL.
    (Take MySQL-5.1.38 source code as an example)
    The location is in storage/innobase/include/univ.i, look in univ.i: UNIV_PAGE_SIZE


   UNIV_PAGE_SIZE is the data page size, the default is 16K.The following remarks indicate that this value can be set to a power of 2.For this value, it can be set to 4k, 8k, 16k, 32K, 64K, which is meaningless in large.
At the same time, after changing UNIV_PAGE_SIZE, you need to change UNIV_PAGE_SIZE_SHIFT.This value is how many powers of 2 are UNIV_PAGE_SIZE, so the data pages are set as follows:


Change the data page of innodb to 8K, and modify it accordingly:


Recompile, then test test, then test.Good luck!


Technical otaku

Sought technology together

Related Topic


Leave a Reply