8 MySQL Performance Optimization Tips _ MySQL

Source: Internet
Author: User
8 MySQL Performance optimization skills bitsCN.com

8 MySQL Performance optimization skills

You have completed your brand's new application, and everything works like a charm. To use your network. Everyone is happy.

Then, suddenly, an explosive user killed your MySQL server and your website was closed. What's wrong? How can you stop it?

The following are some tips for MySQL performance optimization, which will help you and your database.

Focus on

In the early stages of development, you should know the expected number of users of your application. If you want many users, you should think about it. from the very beginning, we plan to replicate, scale, and performance.

However, if you optimize your SQL code, architecture, and indexing policies, you may not need the big environment. You must always think twice about performance and scalability.

Be sure to use EXPLAIN

The EXPLAIN statement can be used as a way to obtain information. the alias for how MySQL executes the SELECT statement is DESCRIBE.

When the previous keyword explain select statement is used, the query execution plan of MySQL display information is optimized. That is to say, MySQL describes how it processes the SELECT statement, including the order in which the table is added. You can use the EXPLAIN extension to provide additional information.

Select the correct data type

It is usually stored on disks (except for some databases and memory databases, it is stored in memory ). This means that, in order to obtain information for your database, it must read the information from the disk and convert it into a result set. you can use it. Disk I/O is extremely slow, especially when comparing other forms of data storage.

When your database grows, it takes a long time to start reading. Poorly designed databases handle this problem by allocating more space than the disks they actually need. This means that the disk occupied by the database is inefficient.

Selecting the correct data type helps ensure that the data we store is as small as possible. Therefore, we only select the data type we need.

Use persistent connection

The reason for using permanent connections is that reducing the number of connections is quite expensive, even if they are faster with MySQL and most other databases.

There are some arguments about this topic. on the network, mysqli extension has disabled the persistent connection function, so I will write

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.