Home >Backend Development >PHP Tutorial >mysql procedure-What technology is used to query more than one million data in MySQL?
mysql procedure please mysql expert phpmysql Chinese linux
What technology should be used to query more than one million data in MySQL to improve the search speed? And memory consumption will be reduced?
The easiest way to optimize queries is indexing.
If you want to do higher-level optimization, you need to analyze the specific problems in detail. Will the data in your table be used by others? Can it be split into multiple tables?
There are also data that may not be queried at ordinary times, which can be stored in a history table.
There are also business restrictions, such as checking data within three months or six months. These methods are all ways to optimize queries.
The next step is to optimize the SQL statement. You can use the query plan to analyze the SQL statement and find out where it consumes time and memory.
When all the above methods have been tried and fail, you may need to expand the hardware device to speed up the process.
In general, there are many ways to optimize query speed, depending on your problem.
Create corresponding indexes based on your query conditions. It can greatly improve the query speed
Explain it first, print out the execution plan, and optimize it according to the actual situation.
Reference from:
MySQL optimization tutorial http://www.data.5helpyou.com/
Establish appropriate indexes, reasonable table structures (intra-table, between tables) and suitable query SQL.
I began to think about how to write an index. After all, query speed index is the most commonly used, but if the amount of data is huge, some existing technologies can also be used