Home > Database > Mysql Tutorial > body text

How much do you know about mysql optimization methods?

坏嘻嘻
Release: 2018-09-15 09:47:25
Original
2673 people have browsed it

This article brings you some reference value for mysql optimization methods. Friends in need can refer to it. I hope it will be helpful to you.

1. Choose the correct storage engine, support transactions for intensive write operations, and use InnoDB. Intensive read operations use MyISAM

2. Table design part
1. Set a primary key id for each table
2. The smaller the column and the fixed-length column, the faster the query will be. It is recommended to use SMALLINT TINYINT as the primary key, VARCHAR length only allocates the required space, and the IP address is stored as int
3. Try to use NOT NULL, NULL requires additional space
4. Mix normal form and anti-normal form

3. Query part
1. Query only the required fields
2. Build indexes for frequently searched fields
3. No column operations, no functions
4. Only query one row of data using LIMIT 1

4. Special skills
1. Turn on query cache
2. Split large sql, one large sql can block the entire database
3. Be careful when using in subquery, mysql Execute the outer layer first and then the inner layer

The above is the detailed content of How much do you know about mysql optimization methods?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template