![]() |
Database »
Database »
SQL Server
Beginner
License: The GNU General Public License (GPL)
Understanding SQL Execution Plan (Part I)By JustChiragPatelBrief Intro of how out t-SQL is parsed and submitted to SQL Engine to retrive data |
SQL, SQL-Server (SQL2005), Architect, DBA, QA
|
||||||||
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
Oh!!! Why my SQL query is taking so much time to retrieve data...?
This is the common question when our SQL query is taking much time to execute. So i will briefly describe hat is happening when we are executing any query.
To understand what is happening when executing SQL query, we must know how the execution (Parsing of SQL statements) is happening. Basically SQL query will be parsed "Top to Bottom and Left to Right".
When ever we Execute any SQL query(Statements) SQL Server will give output by processing this Query in two phase.
1. Relational engine
2. Storage Engine
Our SQL Query will be first given to the Relational Engine of the SQL server to analyze all statements. Means here our query will be parsed and will be optimized in the form so that SQL server can do transaction on that query. At this time our query will be in optimized form means it is the shortest execution plan which can be taken out on the database to retrieve or update the data.
Then after, this optimized query in the form of binary data will be submitted to the Storage Engine, where the actual execution will be done on database. All retrieval or modification of the data will be carried out here.
So in these two steps our query will be executed and we are getting result. So we will focus on the "Relational Engine" part of the execution plan because from here we will get our Answer to the Question "Why my query is getting to much time to execute?".
When we generate the Estimated plan and when we run the query actually and get the actual execution plan then there may be some difference between them. This difference may be due to following scenarios.
In My Next Part of this article, i will show you how to use Execution Plan to improve our query. Part Two will be posted soon.
eBook Dissecting SQL Server Execution Plan By Grant Fritchey.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 12 Aug 2008 Editor: |
Copyright 2008 by JustChiragPatel Everything else Copyright © CodeProject, 1999-2010 Web21 | Advertise on the Code Project |