Inaccurate MySQL execution plan-Overview, mysql execution plan
The execution plan for the Mao MySQL optimizer is often inaccurate, but not optimal (cpu + io )???
Too many factors ::
The information of information_schema is regularly refreshed. In many cases, it is not the most authentic, or even the difference is very large (when it is not a mountain peak, make good use of analyze table and so on );
Now, an enterprise has no money to spend and buys a lot of Solid State disks. It happens that non-intelligent MySQL cannot keep up with the pace of hardware optimization, more than one part of the selection principle may be inaccurate (I believe that other databases are also a pain point );
Environmental factors/
Configuration Factors
And so on...
Mysql execution plan
After mysql5.1, there will be a command called event. When the specified time is reached, your prepared SQL statement will be executed. It should be suitable for you.
The following is an event sentence I wrote a few days ago. I will give you an example. You can modify it as needed.
Delimiter |
Create event 'event1'
On schedule
At '2017-11-27 18:05:00'
Do
Begin
UPDATE limit_master
SET
Limit_value = 2,
Upd_date = now ()
WHERE
Limit_code = 0;
End |
Delimiter;
These are the most basic, and I only specified the time. It is also an execution. If it is executed every day, change the time to every + the time you want (for example, every 1 day/every 1 hour ).
For more information, see the mysql manual.
What is the SQL Execution Plan of MYSQL? Use explain? What is the specific meaning of the MYSQL execution plan?
Using explain, MySQL explains how it processes SELECT and provides the order of how tables are joined and joined. You can see whether the index is correctly used. Based on this, adjust your SQL statement or index creation.