Databases Reference
In-Depth Information
the initial setup has been done, the status changes to runnable . At this point, the worker is ready
to go but there is no free scheduler to allow this worker to run. The worker state remains as run-
nable until a scheduler is available. When the scheduler is available, the worker is associated with
that scheduler, and the status changes to running . It remains
running until either it is done or it releases control while it waits
for something to be done. When it releases control of the sched-
uler, its state moves to suspended (the reason it released control
is logged as a wait_type. When the item it was waiting on is
available again, the status of the worker is changed to runnable.
Now it's back to waiting for a free scheduler again, and the
cycle repeats until the task is complete.
Init
Runnable
Suspended
Running
At that point, the task is released, the worker is released, and
the scheduler is available to be associated with the next worker
that needs to run. The state diagram for scheduling workers is
shown in Figure 5-19.
Done
FIGURE 5-19
SUMMARY
This chapter introduced you to the process of query execution, including the optimization process
and some of the operators used by the Query Optimizer. Then you took a look at query plans,
including the different ways that you can examine them, and how to read them. Finally, you learned
about the objects that SQLOS uses to manage scheduling, and how scheduling works.
Some key points you should take away from this chapter include the following:
SQL Server uses cost-based optimization to i nd what it thinks is a good enough plan. This
won't always be the best plan.
Statistics are a vital part of the optimization process.
Many factors inl uence how SQL Server chooses a query plan.
You can alter the plan chosen using a variety of plan hints and other coni guration settings.
 
 
Search WWH ::




Custom Search