Databases Reference
In-Depth Information
POH.EmployeeID=EMP.BusinessEntityID
JOIN
[Purchasing].[Vendor] AS V
ON
POH.VendorID=V.BusinessEntityID
GROUP BY
POH.PurchaseOrderID
,POH.OrderDate
,EMP.LoginID
,V.Name
GO
2.
Go to the Query menu and click on Display Estimated Execution Plan or press
Ctrl+L which will display the estimated execution plan. Look at the screenshot
given as follows:
How it works...
When we execute any T-SQL statement, it first goes to a relational engine which does two
tasks for us.
F Parse the query with help of the parser
F After getting the response from the parser, query optimizer processes the query and
generates the estimated execution plan
Once the query comes to the query optimizer, it finds out the optimal way to execute the
query by looking at the predicate given in the query. It finds out the statistics, if available,
and indexes to decide the path of execution in form of estimated execution plan which will be
available to the storage engine before it finally executes the query.
Query optimizer is a smart tool in SQL Server 2012 which is used to find the
best optimal way to execute the query in most cases. But, it may address the
sub-optimal way sometimes, due to lack of information such as out dated
statistics or over indexing.
 
Search WWH ::




Custom Search