Advanced SQL tutorial pdf, Define below transformation in DFD?, Difference between Cached Report and Snapshot Report, Download SQL Questions, Download SQL Server Interview Question in PDF, Download SQL SERVER Interview questions, Download SQL Server Interview questions and answers, download sql server interview questions and answers pdf, download sql server interview questions by Pawan Khowal, download sql server interview questions by Pawan Kumar, download sql server interview questions by Pawan Kumar Khowal, Download T-SQL Interview Questions, Free Download SQL SERVER Interview questions, How many type of protection level in SSIS package?, How to create Temporary Table using SSIS?, How to make connection with a FTP server?, How to show "No Data Found" Message to end user?, SQL, SQL Common Interview Questions, SQL Common Interview Questions and answers, SQL FAQ, SQL FAQs, SQL Interview Q & A, SQL Interview Questions, SQL Queries asked in interviews, SQL Questions, SQL Server - General Interview Questions and Answers, SQL Server developer Interview questions and answers, SQL Server developer Interview questions with answers, SQL SERVER Indexes, SQL SERVER Interview questions, SQL SERVER Interview questions & Answers, SQL Server Interview questions and answers, SQL Server Interview Questions and Answers - Free PDF, sql server interview questions and answers for net developers, SQL SERVER Tips, SQL Tips & Tricks, SQL Tips and Tricks, SQL Tricks, T-SQL Server Interview Questions, What are Attunity Driver and why do we user in SSIS?, What are check point and how they work? How check works in for loop?, What are Lazy aggregations?
SQL Server – Logical Binding Order or Logical Query Processing Phases
Today I am going to talk about the logical binding order. This question has been asked to me many times. Here I will try to explain the things in simple manner. Basically SQL is a Declarative language and is not fully relational. It is different from other languages like C# or VB where you have a direct relationship between what you write and how the program works internally, But here the case is different. First go through the Logical Binding Order or Logical Query Processing Phases below-
- GROUP BY
- CUBE / ROLLUP
- ORDER BY
Also understand that this is different from how the things are executed physically or physical execution of the query. Optimizer may change your query internally to fetch the results in an effective manner. E.g. Push down the predicate to the leaf or rewrite the sub query using joins, etc. SQL Engine works row by row mode like what we have in Cursor. Basically, Data flows from RIGHT (TOP) to LEFT in the query plan. That is it data centric view of the query plan. Logic in the query plan flows from LEFT to RIGHT. This is logic centric view of the query plan.
All the operators used in the execution plan are called physical operators or Iterators. Let’s go through an example below-
We know that select and top operator cannot have rows from their own. They are dependent on Clustered Index scan in this case. So when the execution starts the “Select” operator asks the “Top” operator that hey do you have any rows for me, Top operator says that I don’t have rows let me ask “Clustered Index Scan”. Hey “Clustered Index scan” do you have any rows for me and “Clustered index scan” says yes I do have row for you. This goes on till the parent consumer iterator asks for rows.
That’s all folks; I hope you’ve enjoyed the article and I’ll see you soon with more articles.
Pawan Kumar Khowal