Execution plans

  • While you guys argue over the correct answer, I'm going to spend the morning learning what "re-entrant" means. 😀

    ron

    -----
    a haiku...

    NULL is not zero
    NULL is not an empty string
    NULL is the unknown

  • Joined discussion all set to rant (nicely of course) about "wrong" answer but see I'm too late. Points are great for bragging rights but I like the learning and I did learn something by researching my answer. Usually do with QotD; that's why I answer them instead of write them.

    Keep up the good work Steve, and everyone else that contributes to making this a great site.

    Thanks, Al.

    Al Kessler
    It's too bad that
    Common Sense Isn't

  • I'm still learning... and I want to make certain I understand. I've read thru the MSDN content which was linked to the question, and am still having issues.

    Query Plans are reentrant and reusable.

    Execution context, which are specific instances of the plan with values, are reusable and NOT reentrant. (I'm using the analogy of Query Plans are to Execution Context as an Object Class is to an Instantiated Object.)

    I assumed the execution plan was synonymous with query plan, but the answer would imply that execution plan = execution context. Is that correct?

  • it's two differents concepts, first - Query Plans and second - Executions Context.

    the article that Steve Jones said:

    When a cache-able batch is submitted to SQL Server for execution, it is compiled and a query plan for it is put in the plan cache. Query plans are read-only reentrant structures that are shared by multiple users. There are at most two instances of a query plan at any time in plan cache: one for all of the serial executions and one for all of the parallel executions. The copy for parallel executions is common for all of the degrees of parallelism. (Strictly speaking, if two identical queries posed by the same user using two different sessions with the same session options arrive at a SQL Server simultaneously, two query plans exists while they execute. However, at the end of their executions, plan for only one of them is retained in the plan cache.)

    From a query plan, an execution context is derived. Execution contexts hold the values needed for a specific execution of a query plan. Execution contexts are also cached and reused. Each user concurrently executing a batch will have an execution context that holds data (such as parameter values) specific to their execution. Although execution contexts are reused, they are not reentrant (i.e., they are single-threaded). That is, at any point of time, an execution context can be executing only one batch submitted by a session, and while the execution is happening, the context is not given to any other session or user.

    i responded wrong! but i would agreed if the question was: "Execution context are:" and not "Execution plans are:" this is a matter of semantics that leads to error!!!


    [font="Times New Roman"]rfr.ferrari[/font]
    DBA - SQL Server 2008
    MCITP | MCTS

    remember is live or suffer twice!
    the period you fastest growing is the most difficult period of your life!
  • Umm, me too.

    I hesitated when I saw "The bulk of the execution plan is ..." figuring that this was yet another one of the ticky-tack questions, where fine parsing of the true meaning of words like "bulk", and a thorough knowledge of the language of origin of all the words in BOL, would be required.

    After agonizing for a brief moment, I decided that life is too short to agonize over a QOTD. I selected the answer that I would have accepted if I were testing comprehension of a topic.

    Sigh.

    [font="Verdana"]Please don't go. The drones need you. They look up to you.[/font]
    Connect to me on LinkedIn

  • Thomas Abraham (6/28/2011)


    Umm, me too.

    I hesitated when I saw "The bulk of the execution plan is ..." figuring that this was yet another one of the ticky-tack questions, where fine parsing of the true meaning of words like "bulk", and a thorough knowledge of the language of origin of all the words in BOL, would be required.

    After agonizing for a brief moment, I decided that life is too short to agonize over a QOTD. I selected the answer that I would have accepted if I were testing comprehension of a topic.

    Sigh.

    This. I tried to decide if the question was technically completely accurate and talking about both parts of the execution plan (query plan and execution context), or if it wasn't, and did the same thing.

    -Ki

  • got bowled over 🙂

    Regards
    Sushant Kumar
    MCTS,MCP

  • I'm voting with the majority here. Reentrant and reusable. Got to interpret the words the same way - question and explanation. There is a distinction between "query plan" and "execution context"; the question asked about the query plan 🙂

  • I selected the wrong answer because I was thinking about Query Plans and not the entire Execution Plan.

    Execution Context is not reentrant and is part of the Execution plan.

    Thanks Steve... Perhaps I would feel better if you corrected the spelling errors in teexplanation. :w00t:

  • Stephen_W_Dodd (6/28/2011)


    I'm voting with the majority here. Reentrant and reusable. Got to interpret the words the same way - question and explanation. There is a distinction between "query plan" and "execution context"; the question asked about the query plan 🙂

    When I saw it the question said only this "Execution Plans are"

    Did it say something else when you answered the question?

  • The showing answer is wrong .

    SQL Server execution plans have the following main components:

    *

    Query Plan

    The bulk of the execution plan is a re-entrant, read-only data structure used by any number of users. This is referred to as the query plan. No user context is stored in the query plan. There are never more than one or two copies of the query plan in memory: one copy for all serial executions and another for all parallel executions. The parallel copy covers all parallel executions, regardless of their degree of parallelism.

    *

    Execution Context

    Each user that is currently executing the query has a data structure that holds the data specific to their execution, such as parameter values. This data structure is referred to as the execution context. The execution context data structures are reused. If a user executes a query and one of the structures is not being used, it is reinitialized with the context for the new user.

    see this for more details

    http://msdn.microsoft.com/en-us/library/ms181055.aspx

  • Change is Required (6/28/2011)


    The showing answer is wrong .

    SQL Server execution plans have the following main components:

    *

    Query Plan

    The bulk of the execution plan is a re-entrant, read-only data structure used by any number of users. This is referred to as the query plan. No user context is stored in the query plan. There are never more than one or two copies of the query plan in memory: one copy for all serial executions and another for all parallel executions. The parallel copy covers all parallel executions, regardless of their degree of parallelism.

    *

    Execution Context

    Each user that is currently executing the query has a data structure that holds the data specific to their execution, such as parameter values. This data structure is referred to as the execution context. The execution context data structures are reused. If a user executes a query and one of the structures is not being used, it is reinitialized with the context for the new user.

    see this for more details

    http://msdn.microsoft.com/en-us/library/ms181055.aspx%5B/quote%5D

    I second this.

    And if you don't want to copy and paste the above link, just click here.

    -Michael

  • The fully qualified term is "query execution plan" and includes two parts (as mentioned by others). Mr. Jones used the "execution plan" part, the bulk of us arguing for a correction are using "query plan". Maybe there's an argument for both answers. Let's split the difference and give everybody 1 point 😀

  • Change is Required (6/28/2011)


    The showing answer is wrong .

    see this for more details

    http://msdn.microsoft.com/en-us/library/ms181055.aspx%5B/quote%5D

    You should read what you posted closer. What you posted clearly states that

    Query Plan + Execution Context = Execution Plan

    And Execution Context <> reentrant

    According to what you posted the answer is right.

    "showing answer is wrong" = wrong answer

  • Carlton Leach (6/28/2011)


    Have you been drinking Steve? :hehe:

    Carlton, I think I will reuse your post, thanks.

Viewing 15 posts - 16 through 30 (of 49 total)

You must be logged in to reply to this topic. Login to reply