mysql execution plan|Mysql Explain

EXPLAIN is one of the most powerful tools at your disposal for understanding
and optimizing troublesome MySQL queries.
MySQL is executing the query and gives clues about how the query performance can be improved.

* how MySQL joins the tables used
* indexes Status
* Check possible_keys
...

The plan is shown in tabular form

Example:
EXPLAIN
select GeneralCode from transactiontable tt
INNER JOIN gstpurchasemas gpm ON gpm.Code=tt.GeneralCode
INNER JOIN gstpurchasedet gpd ON gpd.PurchaseEntryCode=gpm.Code

You can also add the keyword EXTENDED after EXPLAIN in your query and MySQL will show you additional
information about the way it executes the query.
EXPLAIN EXTENDED
select GeneralCode from transactiontable tt
INNER JOIN gstpurchasemas gpm ON gpm.Code=tt.GeneralCode
INNER JOIN gstpurchasedet gpd ON gpd.PurchaseEntryCode=gpm.Code

Post a Comment

0 Comments