New Tip from the RCS Data Team

October 25, 2018

The EXPLAIN statement is a very useful tool in SQL databases to help users better understand what's going on in queries and where to apply tweaks. For example, the output of EXPLAIN can help you decide where to add indexes and can quickly remedy slow queries by telling you the join type, the possible indexes to choose vs. the index actually chosen, the estimate of rows to be examined, etc.

How do you use EXPLAIN?

Simply put the keyword EXPLAIN in front of the query to be analyzed. EXPLAIN can be used in front of a query beginning with SELECTINSERTDELETEREPLACE, and UPDATE.

EXPLAIN SELECT * FROM t1 WHERE = 12345 OR t1.LastName = 'Something';

The output will look like below:




For more information, you can refer to: