explain --View SQL execution plan for SQL performance investigation
You can use the explain command to see the SQL execution plan. When investigating SQL performance, the first command to try is explain.
explain SQL you want to check
This is a sample that uses explain to investigate the performance of the SQL "select * from book where author_id = 4;". Just add explain before SQL.
explain select * from book where author_id = 4;
Highlights of performance survey
This is the highlight of the performance survey.
Is the index used as the most important point of the performance survey?
The most important point in SQL performance research is whether indexes are used.
If you have a table with tens of thousands or more rows and you are linearly searching all the rows, SQL is dramatically slower. You need to modify the SQL or create an index so that the index is used.