Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server equivalent to MySQL's EXPLAIN

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?

like image 963
Ash Burlaczenko Avatar asked Aug 10 '10 14:08

Ash Burlaczenko


People also ask

What is the equivalent of describe in SQL Server?

If we want to show the structure of a database table or tables in the server then, we will use the SQL command DESCRIBE or other keyword DESC, which is identical to DESCRIBE one.

How can use query execution plan in SQL Server?

You can press Ctrl+L after writing the query in the Query window. In the Context Menu of the Query Window, you will find a menu on the toolbar in SQL Server Management Studio with the name “Display Estimated Execution Plan”. It will work the same way as the above step will do.

What is difference MySQL and SQL Server?

SQL is a query programming language that manages RDBMS. MySQL is a relational database management system that uses SQL. SQL is primarily used to query and operate database systems. MySQL allows you to handle, store, modify and delete data and store data in an organized way.


1 Answers

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:

  • http://www.simple-talk.com/sql/performance/execution-plan-basics/

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.

like image 196
Justin Avatar answered Sep 21 '22 14:09

Justin