Chapter 2: Graphical Execution Plans

4 thoughts on “Chapter 2: Graphical Execution Plans

  • CK

    Hey Grant,

    I am reading through this book right now and I think it is great. I have a question on chapter 4. Does a query using APPLY really count as a derived table? When you use an APPLY operator you are always tying the outer query to the inner query or function. Just like a correlated subquery it will be executed for each row of the outer expression. I always thought of a derived table as something that could be excuted in isolation and treated as its own table. I hope I am not getting caught up in semantics, just looking for a clarification.

    thanks,

    Creighton

  • scarydba

    Believe it or not, I need to back & read what I wrote. I won’t leave you hanging on this, I just need to review what I said to be sure of the context.

  • scarydba

    Morning. I re-read it and now I remember.

    Yeah, the internals of the APPLY operator are basically a similar construct to the derived table. Clearly, not identical.

    I also looked it up in Itzik Ben-Gan’s outstanding T-SQL Querying book. He refers to the APPLY operation as a table expression too. I checked BOL. It too refers to the APPLY construct as a table expression.

    It is a correlation process, but it’s a correlation between tables, effectively, not between a row and a select statement.

    Hopefully that clarifies things a bit.

  • CK

    Grant, thanks for explaining. I had to force myself to overcome the slight reluctance to grasping it as a table expression. I have the T-SQL querying book as well and it definately lists it as a table expression. I went back and looked at your example in chapter 4 (Most recent Price History for a Product). That is a great example of how it behaves as a table expression.

    thanks,

    Creighton

Please let me know what you think about this article or any questions:

This site uses Akismet to reduce spam. Learn how your comment data is processed.