Junior — Middle
What is the role of the EXPLAIN operator when executing SQL queries in a database?
sobes.tech AI
Answer from AI
The EXPLAIN operator in SQL is used to analyze and understand how the database plans to execute a given query. It shows the execution plan, including the order of operations, used indexes, join types, and estimated cost. This helps optimize queries, identify bottlenecks, and improve performance.
Example of usage:
EXPLAIN SELECT * FROM users WHERE age > 30;
The result will show which indexes are used and how data filtering is performed.