Monday, 22 April 2024

Explain statement in Mysql

1. What to use Explain statement for?

- Using explain in mysql to obtain information about how Mysql execute a select statement.
- Information Explain Statement provide:
+ Type: follow all->index->range->ref->eq->ref->const->system.
+ select_type: SIMPLE for simple select; SUBQUERY for a subquery
+ Rows: number of rows checked
+ Table: table involved in the select operation.
......

2. How to use Explain statement ?

EXPLAIN SELECT * FROM my_table WHERE id = 1;

Example

explain SELECT * FROM `order_info` WHERE note LIKE 'keywork'

explain SELECT * FROM `order_info` WHERE client_id = 1

3. What does Explain statement include? 

Thank you

No comments:

Post a Comment

Golang Advanced Interview Q&A