MySQL Performance Optimization
Schema and data type optimization
InnoDB Index Optimization
Query performance optimization 1. For inefficient queries, we usually analyze them from two aspects:
2. Generally, MySQL can use the following three methods to apply WHERE conditions, from best to worst:
3.MySQL is designed to make connections and disconnections lightweight and efficient in returning small query results. On a general-purpose server, it is possible to run more than 100,000 queries per second. A gigabit network card can easily handle more than 2,000 queries per second. MySQL can scan millions of rows of data in memory per second. 4. When deleting a large amount of data, it is recommended to pause for a while after deleting a small batch of data before deleting the next batch. 5. Sorting is a very costly operation anyway, so from a performance perspective, you should avoid sorting as much as possible or avoid sorting large amounts of data as much as possible. 6. The COUNT() function has two different functions: it can count the number of values in a column or the number of rows. The simplest way is to count the number of rows through COUNT(*) 7. When doing a related query, make sure there is an index on the related field 8. If the amount of data is large and historical data needs to be deleted regularly, you can consider using a partition table 9. If the specified index column and partition column do not match, the query will fail to perform partition filtering 10. Avoid foreign key constraints as much as possible, usually implemented through programming, and keep foreign keys in mind 11. It is best not to use triggers, stored procedures, custom functions, etc. 12. Use query cache as much as possible. If there is some uncertain data (such as NOW() or CURRENT_DATE()) when writing query statements, it will not be cached. 13. Using multiple small tables instead of one large table is good for query caching 14. When writing in batches, only one cache invalidation is required, so it is more efficient than single writes (the cache is invalidated every time a write is made). For write-intensive applications, directly disable the query cache. 15. If the cache space is too large, the server may freeze during the expiration operation The above is a summary of my personal experience at work. If there are any errors in the description, I hope you can help point them out so that we can communicate and learn together! This is the end of this article about sharing MySQL performance optimization tips. For more relevant MySQL performance optimization content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Encapsulation method of Vue breadcrumbs component
>>: Detailed explanation of Linux index node inode
Docker installation 1. Requirements: Linux kernel...
Achieve results First use HTML to build a basic f...
A record of an online MySQL transaction problem L...
Effect display: Environment preparation controlle...
Operating system: Window10 MySQL version: 8.0.13-...
Table of contents 1. Introduction 2. Installation...
Table of contents MySQL basic common commands 1. ...
Tip 1: Stay focused The best mobile apps focus on...
This article shares the specific code for JavaScr...
A Thorough Analysis of HTML (14) Special Characte...
Compatible with new CSS3 properties In CSS3, we c...
Keepalived+Nginx+Tomcat to achieve high availabil...
The google.html interface is as shown in the figur...
Introduction to Flex Layout Flex in English means...
Table of contents Throttling and anti-shake conce...