Simple-Talk has posted Chapter 2 of the book online. The one thing missing from the chapter (and the book for that matter) that you really need is sys.dm_exec_query_plans. That DMV is a must have for working with execution plans.
Simple-Talk has posted Chapter 2 of the book online. The one thing missing from the chapter (and the book for that matter) that you really need is sys.dm_exec_query_plans. That DMV is a must have for working with execution plans.
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
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.
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.
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