Modify the InnoDB data page size to optimize the Mysql method _mysql

Source: Internet
Author: User

We know that the InnoDB data page is 16K, and is a hard rule, the system does not change the way, I hope that in the future, MySQL can also support the size of a variety of data pages.
But in practical applications sometimes the 16K is a bit large, especially if many businesses are moving to MySQL when Oracle or SQL Server is doing well and finding IO growth too obvious,
You'll want to change the size of the data page.
Actually InnoDB's data page size can also be changed, just need to change in the source layer, and then rebuild MySQL again.
Ways to change:
(Take MySQL-5.1.38 source code as an example)
Position in Storage/innobase/include/univ.i, find in UNIV.I: univ_page_size


/*
  Database VERSION Control ======================== * * * The
 
Universal page size of the database */
    #define UNIV_PAGE_SIZE     (2 * 8192)/* note! Currently, this has is a power of
   2 *
///* The 2-logarithm of univ_page_size: * *
#define Univ_page_size_shif T/
 
* Maximum number of parallel threads in a parallelized operation/
#define Univ_max_parallelism 32

The univ_page_size is the data page size, and the default is 16K. The following note indicates that the value can be set to a second party that must be 2. For this value can be set to 4k,8k,16k,32k,64k, there is no meaning in the big.
When you change the univ_page_size, you need to change the univ_page_size_shift the number of times the value is 2 is univ_page_size, so set the data page as follows:


#define Univ_page_size_shift an If univ_page_siz=4k
#define Univ_page_size_shift if univ_page_siz=8k
# Define Univ_page_size_shift if univ_page_siz=32k

Example:
Change the data page for InnoDB to 8K, and modify it accordingly:


/*
  Database VERSION Control ======================== * * * The
 
Universal page size of the database */
    #define Univ_page_size     8192/  * note! Currently, this has is a power of
   2 *
///* The 2-logarithm of univ_page_size: * *
#define Univ_page_size_s Hift/
 
* Maximum number of parallel threads in a parallelized operation/
#define Univ_max_parallelism 32

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.