修改Innodb的数据页大小以优化MySQL的方法 |
本文标签:MySQL 我们知道Innodb的数据页是16K,而且是一个硬性的规定,系统里没更改的办法,希望将来MySQL也能也Oracle一样支持多种数据页的大小 。 /* DATABASE VERSION CONTROL ======================== */ /* The universal page size of the database */ #define UNIV_PAGE_SIZE (2 * 8192) /* NOTE! Currently, this has to be a power of 2 */ /* The 2-logarithm of UNIV_PAGE_SIZE: */ #define UNIV_PAGE_SIZE_SHIFT 14 /* Maximum number of parallel threads in a parallelized operation */ #define UNIV_MAX_PARALLELISM 32 UNIV_PAGE_SIZE就是数据页大小,默认的是16K. 后面的备注里标明,该值是可以设置必须为2的次方 。对于该值可以设置成4k,8k,16k,32K,64K,在大也没意义了 。 #define UNIV_PAGE_SIZE_SHIFT 12 if UNIV_PAGE_SIZ=4K #define UNIV_PAGE_SIZE_SHIFT 13 if UNIV_PAGE_SIZ=8K #define UNIV_PAGE_SIZE_SHIFT 15 if UNIV_PAGE_SIZ=32K 例子: /* DATABASE VERSION CONTROL ======================== */ /* The universal page size of the database */ #define UNIV_PAGE_SIZE 8192 /* NOTE! Currently, this has to be a power of 2 */ /* The 2-logarithm of UNIV_PAGE_SIZE: */ #define UNIV_PAGE_SIZE_SHIFT 13 /* Maximum number of parallel threads in a parallelized operation */ #define UNIV_MAX_PARALLELISM 32 重新编译,然后测试测试,再测试 。Good luck! |