Question

During an investigation of some client machines losing their connection with SQL Server 2005, I ran into the following line of code on the web:

Select * FROM sys.dm_exec_query_optimizer_info WHERE counter = 'timeout'

When I run this query on our server - we are getting the following results:

counter - occurrence - value

timeout - 9100 - 1

As far as I can determine, this means that the query optimizer is timing out while trying to optimize queries run against our server – 9100 times. We are however, not seeing any timeout errors in the SQL Server error log, and our end-users have not reported any timeout specific errors.

Can anyone tell me what this number of “occurrences” means? Is this an issue we should be concerned about?

Was it helpful?

Solution

This counter is nothing to do with your connection issues.

SQL Server won't spend forever trying to compile the best possible plan (at least without using trace flags).

It calculates two values at the beginning of the optimisation process.

  1. Cost of a good enough plan
  2. Maximum time to spend on query optimisation (this is measured in number of transformation tasks carried out rather than clock time).

If a plan with a cost lower than the threshold is found then it needn't continue optimising. Also if it exceeds the number of tasks budgeted then optimisation will also end and it will return the best plan found so far.

The reason that optimisation finished early shows up in the execution plan in the StatementOptmEarlyAbortReason attribute. There are actually three possible values.

  • Good enough plan found
  • Timeout
  • Memory Limit Exceeded.

A timeout will increment the counter you ask about in sys.dm_exec_query_optimizer_info.

Further Reading

OTHER TIPS

The occurence column will tell you the number of times that counter has been incremented and the value column is an internal column for this counter.

See here

Sorry, the documentation say this is internal only.

Based on the other link, I suspect this is for internal engine timeouts (eg SET QUERY_GOVERNOR_COST_LIMIT)

A client timeout will also not be logged in SQL because the client aborts the batch, ths stopping SQL processing.

Please do you have more details?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top