Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Semestr2 / 1 - Oracle / Oracle selected docs / Database concepts.pdf
Скачиваний:
29
Добавлен:
12.05.2015
Размер:
6.96 Mб
Скачать

SQL Operations That Can Be Parallelized

SQL Operations That Can Be Parallelized

Most operations can be parallelized. The following are commonly parallelized to improve performance:

Parallel Query

Parallel DDL

Parallel DML

SQL*Loader

See Also: Oracle9i Data Warehousing Guide for specific information regarding restrictions for parallel DML as well as some considerations to keep in mind when designing a warehouse

Parallel Query

You can parallelize queries and subqueries in SELECT statements, as well as the query portions of DDL statements and DML statements (INSERT, UPDATE, and DELETE). However, you cannot parallelize the query portion of a DDL or DML statement if it references a remote object. When you issue a parallel DML or DDL statement in which the query portion references a remote object, the operation is automatically run serially.

See Also: Oracle9i SQL Reference for information about the syntax and restrictions for parallel query statements

Parallel DDL

You can normally use parallel DDL where you use regular DDL. There are, however, some additional details to consider when designing your database. One important restriction is that parallel DDL cannot be used on tables with object or LOB columns.

DDL Statements that can be Parallelized

You can parallelize the CREATE TABLE AS SELECT, CREATE INDEX, and ALTER INDEX REBUILD statements. If the table is partitioned, you can parallelize ALTER TABLE MOVE or [SPLIT or COALESCE] statements as well. You can also use parallelism for ALTER INDEX REBUILD [or SPLIT] when the index is partitioned.

All of these DDL operations can be performed in NOLOGGING mode for either parallel or serial execution.

18-12 Oracle9i Database Concepts

SQL Operations That Can Be Parallelized

The CREATE TABLE statement for an index-organized table can be parallelized either with or without an AS SELECT clause.

Different parallelism is used for different operations. Parallel create (partitioned) table as select and parallel create (partitioned) index run with a degree of parallelism equal to the number of partitions.

Parallel operations require accurate statistics to perform optimally.

See Also:

Oracle9i SQL Reference for information about the syntax and restrictions for parallel DDL statements

Oracle9i Application Developer’s Guide - Large Objects (LOBs) for information about LOB restrictions

Parallel DML

Parallel DML (parallel insert, update, and delete) uses parallel execution mechanisms to speed up or scale up large DML operations against large database tables and indexes. You can also use INSERT ... SELECT statements to insert rows into multiple tables as part of a single DML statement. You can normally use parallel DML where you use regular DML.

Although data manipulation language (DML) normally includes queries, the term parallel DML refers only to inserts, updates, upserts and deletes done in parallel.

See Also:

Oracle9i SQL Reference for information about the syntax and restrictions for parallel DML statements

Oracle9i Data Warehousing Guide for specific information regarding restrictions for parallel DML as well as some considerations to keep in mind when designing a warehouse

SQL*Loader

You can parallelize the use of SQL*Loader, where large amounts of data are routinely encountered. To speed up your loads, you can use a parallel direct-path load as in the following example:

SQLLOAD USERID=SCOTT/TIGER CONTROL=LOAD1.CTL DIRECT=TRUE PARALLEL=TRUE

SQLLOAD USERID=SCOTT/TIGER CONTROL=LOAD2.CTL DIRECT=TRUE PARALLEL=TRUE

SQLLOAD USERID=SCOTT/TIGER CONTROL=LOAD3.CTL DIRECT=TRUE PARALLEL=TRUE

Parallel Execution of SQL Statements 18-13

SQL Operations That Can Be Parallelized

You can also use a parameter file to achieve the same thing.

An important point to remember is that indexes are not maintained during a parallel load.

See Also: Oracle9i Database Utilities for information about the syntax and restrictions for parallel loading

How to Make a Statement Run in Parallel

The way you make a statement run in parallel depends upon the type of parallel operation. The three types of parallel operation are:

Parallel Query

Parallel DDL

Parallel DML

Parallel Query

To achieve parallelism for SQL query statements, one or more of the tables being scanned should have a parallel attribute.

Parallel DDL

To achieve parallelism for SQL DDL statements, the parallel clause should be specified.

Parallel DML

Due to the differences in locking between serial and parallel DML, you must explicitly enable parallel DML before you can use it. To achieve parallelism for SQL DML statements, you must first enable parallel DML in your session:

ALTER SESSION ENABLE PARALLEL DML;

Then any DML issued against a table with a parallel attribute will occur in parallel, if no PDML restrictions are violated. For example:

INSERT INTO mytable SELECT * FROM origtable;

18-14 Oracle9i Database Concepts

SQL Operations That Can Be Parallelized

See Also:

Oracle9i SQL Reference for information about the syntax to implement parallelism

Oracle9i Database Reference for information about the syntax to implement parallelism from a parameter file

Oracle9i Data Warehousing Guide for specific information regarding restrictions for parallel DML

Parallel Execution of SQL Statements 18-15

SQL Operations That Can Be Parallelized

18-16 Oracle9i Database Concepts

Соседние файлы в папке Oracle selected docs