Saturday, April 30, 2011

SQL Server parallel processing


SQL Server parallel processing

SQL Server provides parallel queries to optimize query execution and index operations for computers that have more than one microprocessor (CPU). Because SQL Server can perform a query or index operation in parallel by using several operating system threads, the operation can be completed quickly and efficiently

How Parallel Execution Works on SQL Server

SQL Server looks for queries or index operations that might benefit from parallel execution.For these queries, SQL Server inserts exchange operators into the query execution plan to prepare the query for parallel execution. An exchange operator is an operator in a query execution plan that provides process management, data redistribution, and flow control.

The exchange operator includes the Distribute Streams, Repartition Streams, and Gather Streams logical operators as subtypes, one or more of which can appear in the Showplan output of a query plan for a parallel query.

After exchange operators are inserted, the result is a parallel-query execution plan. A parallel-query execution plan can use more than one thread.The actual number of threads used by a parallel query is determined at query plan execution initialization and is determined by the complexity of the plan and the degree of parallelism. Degree of parallelism determines the maximum number of CPUs that are being used.

Degree of Parallelism in SQL Server

SQL Server automatically detects the best degree of parallelism for each instance of a parallel query execution or index data definition language (DDL) operation. It does this based on the following criteria:

Whether SQL Server is running on a computer that has more than one microprocessor or CPU, such as a symmetric multiprocessing computer (SMP).

Whether sufficient threads are available.

The type of query or index operation executed.

Whether there are a sufficient number of rows to process.

Whether current distribution statistics are available.

Labels: ,

0 Comments:

Post a Comment

<< Home