MySQL optimization and mysql Optimization

Source: Internet
Author: User

MySQL optimization and mysql Optimization

1. cache pool

MySQL is designed to use a cache pool. That is to say, some data is stored in the memory. When we look for a data, if we find it in the cache pool, you can directly
Obtain from the cache. If not, load it to the disk. Therefore, we recommend that you use a 64-bit operating system for the database server to use a large memory. The following parameters are used to set the memory pool.
Of:

SHOW VARIABLES LIKE "innodb_buffer_pool_instances"

To view the number of cache pools, you can use globle or directly set them in the configuration file.

show VARIABLES like "innodb_buffer_pool_size"

View the size of each cache pool. The queried size is byte.

Note that this setting takes into account the capabilities of your server.

To verify the cache hit rate, you can pass

SHOW ENGINE INNODB STATUS

One row of output is very important. We can see that the hit rate is:

Buffer pool hit rate 1000 / 1000

Indicates the cache hit rate, which generally cannot be lower than 95%.

2. LRU list

Data is stored in the cache through LRU, that is, the latest data to be queried is placed at the beginning, that is, hotspot data, but this LRU algorithm has some variants, specifically each time

The queried data is not inserted to the first position, but inserted to the center. This position becomes the midpoint. The default position is 3/5, the reason for this is to prevent some table scan operations from

All the data is refreshed. Several parameters can be set.

SHOW VARIABLES LIKE "innodb_old_blocks_pct"

Indicates the position of the midpoint. The default value is:

About 3/5.

Another parameter is

SHOW VARIABLES LIKE "innodb_old_blocks_time"

That is, how long it takes for data to be inserted to the midpoint to take effect.

If hotspot data is concentrated in a real environment, you can set the LRU parameter to prevent hotspot data from being flushed out.

3. Index

Http://www.cnblogs.com/zr520/p/6405197.html

Related Article

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.