Explain profiling
It is recommended to provide the following information
Show table status like ' audit ';
Show create table audit;
Show index from audit;
Check table audit;
Analyze table audit;
Analyze does not check the table for problems, just re-analyze the distribution of the keys.
Check Table/repaire table is a statement that is checked and repaired
SELECT * FROM [TABLE] Force INDEX (MYINDEX2) WHERE [Column1] = [value1] and [column2] = [value2] ORDER by [id] DESC LIMIT0 , 10;
Insert Ignore into
When we want to use Sql_no_cache to suppress the results cache, we find that the results are not the same as our expectations, and the result of query execution is still the result of the cache. In fact, the real function of Sql_no_cache is to disallow caching of query results, but it does not mean that the cache is not returned to query as a result.
MySQL Quick add millions record statement:
When you insert a record using the Insert SELECT statement, you must follow these guidelines.
When you select data with a SELECT statement, you cannot select rows from the table in which the data is inserted.
Specifies that the inserted table must contain the same number of fields as the number of fields returned in the SELECT statement.
Specifies that the inserted table should contain a field data type that is the same as the field data type returned in the SELECT statement, or the system can be automatically converted.
Copy CodeThe code is as follows:
INSERT into Ler_items (ClassID, title, address, ZipCode)
SELECT ClassID, title, address, ZipCode
From Ler_items
Using the SQL statement above, you can add millions of records to the Ler_items table in a short period of time, and it is helpful to test the database