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

Partitioning Methods

Partitioned Index-Organized Tables

You can range partition index-organized tables. This feature is very useful for providing improved manageability, availability and performance for index-organized tables. In addition, data cartridges that use index-organized tables can take advantage of the ability to partition their stored data. Common examples of this are the Image and interMedia cartridges.

For partitioning an index-organized table:

Only range and hash partitioning are supported

Partition columns must be a subset of primary key columns

Secondary indexes can be partitioned — locally and globally

OVERFLOW data segments are always equipartitioned with the table partitions

Partitioning Methods

Oracle provides the following partitioning methods:

Range Partitioning

List Partitioning

Hash Partitioning

Composite Partitioning

Figure 11–2 offers a graphical view of the methods of partitioning.

Partitioned Tables and Indexes 11-5

Partitioning Methods

Figure 11–2 List, Range, and Hash Partitioning

 

 

 

List

 

 

Range

 

 

 

 

Hash

 

 

Partitioning

 

Partitioning

 

 

Partitioning

East Sales Region

January and

 

 

 

 

 

 

New York

 

 

 

February

 

 

 

 

 

 

 

 

 

 

 

 

 

Virginia

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Florida

 

 

 

h1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

West Sales Region

March and

h2

 

 

 

 

 

California

 

 

April

h3

 

 

 

 

 

 

 

 

 

 

Oregon

 

 

 

 

 

 

h4

 

 

 

 

 

Hawaii

 

 

 

 

 

 

 

 

 

Central Sales Region

May and

 

 

 

 

 

 

Illinois

 

 

June

 

 

 

 

 

 

 

 

 

 

 

 

 

Texas

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Missouri

 

 

 

 

 

 

 

 

 

 

 

 

 

July and

 

 

 

 

 

 

 

 

 

 

August

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Composite partitioning is a combination of other partitioning methods. Oracle currently supports range-hash and range-list composite partitioning. Figure 11–3 offers a graphical view of range-hash and range-list composite partitioning.

11-6 Oracle9i Database Concepts

 

 

 

 

 

 

 

 

Partitioning Methods

 

 

 

 

 

 

 

 

 

 

 

Figure 11–3

Composite Partitioning

 

 

Composite Partitioning

 

 

 

 

Composite Partitioning

Range-Hash

 

 

 

 

Range - List

 

h1

 

 

 

 

January and

March and

May and

 

 

 

 

 

February

April

June

h2

 

East Sales Region

 

 

 

h3

 

 

 

h1

h4

New York

 

 

 

 

 

 

 

 

 

 

 

h2

Virginia

 

 

 

 

 

 

Florida

 

 

 

h3

 

 

 

h1

h4

 

 

 

 

 

 

 

West Sales Region

 

 

h2

 

California

 

 

 

 

 

 

 

 

h1

h3

 

Oregon

 

 

 

 

 

 

h4

Hawaii

 

 

h2

 

Central Sales Region

 

 

 

h3

 

 

 

 

h4

Illinois

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Texas

 

 

 

 

 

 

 

 

 

 

 

 

Missouri

Range Partitioning

Range partitioning maps data to partitions based on ranges of partition key values that you establish for each partition. It is the most common type of partitioning and is often used with dates. For example, you might want to partition sales data into monthly partitions.

When using range partitioning, consider the following rules:

Each partition has a VALUES LESS THAN clause, which specifies a noninclusive upper bound for the partitions. Any binary values of the partition key equal to or higher than this literal are added to the next higher partition.

All partitions, except the first, have an implicit lower bound specified by the VALUES LESS THAN clause on the previous partition.

A MAXVALUE literal can be defined for the highest partition. MAXVALUE represents a virtual infinite value that sorts higher than any other possible value for the partition key, including the null value.

A typical example is given in the following section. The statement creates a table (sales_range) that is range partitioned on the sales_date field.

Partitioned Tables and Indexes 11-7

Partitioning Methods

Range Partitioning Example

CREATE TABLE sales_range (salesman_id NUMBER(5), salesman_name VARCHAR2(30), sales_amount NUMBER(10), sales_date DATE)

PARTITION BY RANGE(sales_date)

(

PARTITION sales_jan2000 VALUES LESS THAN(TO_DATE('02/01/2000','DD/MM/YYYY')), PARTITION sales_feb2000 VALUES LESS THAN(TO_DATE('03/01/2000','DD/MM/YYYY')), PARTITION sales_mar2000 VALUES LESS THAN(TO_DATE('04/01/2000','DD/MM/YYYY')), PARTITION sales_apr2000 VALUES LESS THAN(TO_DATE('05/01/2000','DD/MM/YYYY')) );

List Partitioning

List partitioning enables you to explicitly control how rows map to partitions. You do this by specifying a list of discrete values for the partitioning key in the description for each partition. This is different from range partitioning, where a range of values is associated with a partition and from hash partitioning, where a hash function controls the row-to-partition mapping. The advantage of list partitioning is that you can group and organize unordered and unrelated sets of data in a natural way.

The details of list partitioning can best be described with an example. In this case, let’s say you want to partition a sales table by region. That means grouping states together according to their geographical location as in the following example.

List Partitioning Example

CREATE TABLE sales_list (salesman_id NUMBER(5), salesman_name VARCHAR2(30), sales_state VARCHAR2(20), sales_amount NUMBER(10), sales_date DATE)

PARTITION BY LIST(sales_state)

(

PARTITION sales_west VALUES('California', 'Hawaii'),

PARTITION sales_east VALUES ('New York', 'Virginia', 'Florida'), PARTITION sales_central VALUES('Texas', 'Illinois')

PARTITION sales_other VALUES(DEFAULT) );

11-8 Oracle9i Database Concepts

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