How to optimize the slow query of large mysql tables?
Optimization method for slow queries on large mysql tables: 1. Reasonably build indexes, usually queries using indexes are faster than not using indexes; 2. Create horizontal partitions for key fields, such as time fields, if the query conditions are frequent Querying through the time range can improve a lot of performance; 3. Establish a coarse-grained data table; 4. Use cache. (Recommended tutorial: mysql video tutorial) If the data table in the mysql database is too large, the query will slow down, so this How to optimize it? The following article will introduce to you the optimization method of slow query when the mysql database table is too large. It has certain reference value. Friends in need can refer to it. The mysql database table is too large and the query is slow to optimize 1. Reasonably build an index Usually it is better to use an index than not to use an index for query Quick, you can check whether the index is used through explain. The specific explain usage method, such as http://www.cnitblog.com/aliyiyi08/archive/2008/09/09/48878.html When the query includes group by and the group by field belongs to the index field, if the query result cannot be determined by the group…