2

Based on Technet, Query Governor Cost Limit refers to the estimated elapsed time, in seconds. This meets this excerpt from the Microsoft SQL Server 2008 Administrator's Pocket Consultant book.

Walking to the book Microsoft SQL Server 2012 Unleashed, pages 30 and 31, the cost limit is proportional to the estimated time, and one should apply a factor (K), to take into account the system's specifics, so it would be K x time(s).

Now, if I take this (somehow older) article, it feels like establishing a relationship between cost limit and time is not doable.

Can I say that in the real world, despite some more rare exceptions, the 2nd approach could be taken as a rule of thumb?

2

Based on my notes from SQL Server internals (by Kalen Delaney).... below is my understanding

Query Governor Cost limit is the max no. of seconds that a query can run.

So, essentially :

  • a non-zero or a negative value will disallow execution of any query that has an estimated cost exceeding that value.
  • Zero which is default - turns off the query governor and all the queries are allowed to run without any time limit.

Note that the value set for seconds isn’t clock-based. It corresponds to seconds on a specific hardware configuration used during product development, and the actual limit might be higher or lower on your machine.

Also, it should be noted that changing the Query Governor Cost limit will flush the entire plan cache resulting in generating a new plan afterwards.

  • +1 important note about flushing the plan cache! An important curiosity; though this article states that issuing a RECONFIGURE will clear the cache plan, it becomes clear in here that only some of them (in which the QG Cost limit is included) actually cause it. – JoseTeixeira Sep 11 '14 at 16:45
  • 1
    @user16484 Yes, that 5-year old article could probably have a better qualifier on that bullet point. I've passed that info along to the author - whether he has any power to see a change through at this point is probably unlikely. – Aaron Bertrand Sep 11 '14 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.