SQL Server equivalent to MySQL's EXPLAIN

Ash Burlaczenko picture Ash Burlaczenko · Aug 10, 2010 · Viewed 35.7k times · Source

I was reading an SQL tutorial which used the keyword EXPLAIN to see how a query is executed. I tried it in SQL Server 2008 with no success.

How do I get the equivalent result?

Answer

Justin picture Justin · Aug 10, 2010

I believe that the EXPLAIN keyword is an MySQL concept - the equivalent Microsoft SQL server concept is the execution plan.

The simplest way of getting an execution plan is to turn on the "Show actual execution plan" menu item (in the query menu) in SQL server management studio. Alternatively you can read a more in-depth guide on execution plans here:

This article goes into a lot more detail on what execution plans are, how to obtain an execution plan, and the different execution plan formats.