MySQL Learning four SQL optimization

Source: Internet
Author: User
Tags mysql query

mysql logical architecture:

The first layer: the client layer, connection processing, authorization authentication, security and other functions.

Second layer: core layer, query parsing, analysis, optimization, caching, built-in functions (time, math, encryption), stored procedures, triggers, views

Tier Three: the storage engine. Responsible for the storage and extraction of data in MySQL.

  

MySQL query process

  Client/server-side communication protocol:

  

  

  
  

  

  

1 Learning to use explain

???

2 Creating the correct index

The index of the database is the same as the index of the book, where their location information is saved and contains the primary information of the database. You can use explain to find

The missing index.

3 deny default settings : There are three settings for MySQL performance optimizations:

Innodb_buffer_pool_size: Data and indexes are used as buffer pools for caching. When the database server has a large amount of system memory, it can be used.

This setting should not be too large, and do not cause frequent exchange.

Innodb_log_file_size: Single InnoDB log file size.

Max_connections: Maximum number of connections

4 loading the database into memory

  Put frequently accessed data into memory (e.g. 30% of data into memory)

5 SSD Storage

6 horizontal expansion??

 Vertical expansion

Horizontal Scaling

7 Pursuit of Visualization

  Database is affected by traffic load, application and other errors, in order to quickly and effectively solve the problem, need to have a monitoring mechanism.

Common monitoring tools: MySQL Enterprise monitor/Monyog/percona

  

  

  

  

  

  

  

  

MySQL Learning four SQL optimization

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.