Oracle Partitioning
Oracle Partitioning
Oracle Partitioning, an option of Oracle9i Enterprise Edition, can enhance the manageability,
performance, and availability of a wide variety of applications. Partitioning allows tables, indexes, and
index-organized tables to be subdivided into smaller pieces, enabling these database objects to be
managed and accessed at a finer level of granularity. Oracle provides a rich variety of partitioning
schemes to address every business requirement. Moreover, since it is entirely transparent in SQL
statements, partitioning can be applied to almost any application.
Benefits of Partitioning
Partitioning can provide tremendous benefits to a wide variety of applications by improving manageability,
performance, and availability. It is not unusual for partitioning to improve the performance of certain queries or
maintenance operations by an order of magnitude. Moreover, partitioning can greatly simplify common administration
tasks.
Partitioning also enables database designer and administrators to tackle some of the toughest problems posed by
cutting-edge applications. Partitioning is a key tool for building multi-terabyte systems or systems with extremely high
availability requirements.
Basics of Partitioning
Partitioning allows a table, index or index-organized table to be subdivided into smaller pieces. Each piece of
database object is called a partition. Each partition has its own name, and may optionally have its own storage
characteristics, such as having table compression enabled or being stored in different tablespaces. From the
perspective of a database administrator, a partitioned object has multiple pieces which can be managed either
collectively or individually. This gives the administrator considerably flexibility in managing partitioned objects.
However, from the perspective of the application, a partitioned table is identical to a non-partitioned table; no
modifications are necessary when accessing a partitioned table using SQL DML commands.
Tables are partitioned using a 'partitioning key', a set of columns which determine in which partition a given row will
reside. Oracle9i provides five techniques for partitioning tables:
• Range Partitioning: Each partition is specified by a range of values of the partitioning key (for a table with a
date column as the partitioning key, the 'January-2001' partition contains rows with the partitioning-key values
from '01-JAN-2001' - '31-JAN-2001')
• List Partitioning: Each partition is specified by a list of values of the partitioning key (for a table with a region
column as the partitioning key, the 'North America' partition may contain values 'Canada', 'USA', and 'Mexico')
• Hash Partitioning: A hash algorithm is applied to the partitioning key to determine the partition for a given row
• Composite Range-Hash Partitioning: A combination of the Range and Hash partitioning technique. The table
is first range-partitioned, and then each individual range-partition is further sub-partitioned using the hash
partitioning technique. All sub-partitions for a given range partition together represent a logical subset of the
data.
• Composite Range-List Partitioning: A combination of the Range and List partitioning technique. The table is
first range-partitioned, and then each individual range-partition is further sub-partitioned using a list
partitioning technique. Unlike composite Range-Hash partitioning, the content of each sub-partition represents
a logical subset of the data, described by its appropriate Range and List partition setup.
• Local Indexes: A local index is an index on a partitioned table which is partitioned in the exact same manner
as the underlying partitioned table. Each partition of a local index corresponds to one and only one partition of
the underlying table.
• Global Partitioned Indexes: A global partitioned index is an index on a partitioned or non-partitioned table
which is partitioned using a different partitioning-key from the table. Global-partitioned indexes can only be
partitioned using range partitioning. For example, a table could be range-partitioned by month and have
twelve partitions, while an index on that table could be range-partitioned using a different partitioning key and
have a different number of partitions.
• Global Non-Partitioned Indexes: A global non-partitioned index is essentially identical to an index on a non-
partitioned table. The index structure is not partitioned.
Oracle provides a robust set of techniques for partitioning tables, indexes, and index-organized tables, so that
partitioning can be optimally applied to any application in any business environment.
Oracle additionally provides a complete set of SQL commands for managing partitioning tables. These include
commands for adding new partitions, dropping partitions, splitting partitioning, and merging partitions.
With partitioning, maintenance operations can be focused on particular portions of tables. For example, a database
administrator could back up a single partition of a table, rather than backing up the entire table. For maintenance
operations across an entire database object, it is possible to perform these operations on a per-partition basis, thus
dividing the maintenance process into more manageable chunks.
A typical usage of partitioning for manageability is to support a 'rolling window' load process in a data warehouse.
Suppose that a DBA loads new data into a table on weekly basis. That table could be range-partitioned so that each
partition contains one week of data. The load process is simply the addition of a new partition. Adding a single
partition is much more efficient than modifying the entire table, since the DBA does not need to modify any other
partitions. The same is true for purging data from a partitioned table. You simply drop a partition, a very cheap and
quick data dictionary operation, rather than issuing a DELETE command, using lots of resources and touching all the
data to be deleted.
• Partitioning Pruning: Partitioning pruning is the simplest and also the most substantial means to improve
performance using partitioning. Partition pruning can often improve query performance by several orders of
magnitude. For example, suppose an application contains an Orders table containing a historical record of
orders, and that this table has been partitioned by week. A query requesting orders for a single week would
only access a single partition of the Orders table. If the Orders tables had 2 years of historical data, this query
would access one partition instead of 104 partitions. This query could potentially execute 100x fast simply
because of partition-pruning. Partition pruning works with all of Oracle's other performance features. Oracle
will utilize partition pruning in conjunction with any indexing technique, join technique, or parallel access
method.
• Partition-wise Joins: Partitioning can also improve the performance of multi-table joins, by using a technique
known as partition-wise join. Partition-wise joins can be applied with two tables are being joined together, and
both of these tables are partitioned on the join key. Partition-wise joins breaks a large join into smaller joins
that occur between each of the partitions, completing the overall join in less time. This offers significant
performance benefits both for serial and parallel execution.
• Parallel Execution Of Updates and Deletes: Partitioning enables the unlimited parallel execution of UPDATE,
DELETE, and MERGE statements. Oracle will parallelize SELECT statements and INSERT statements when
accessing both partitioned and non-partitioned database objects. UPDATE, DELETE and MERGE statements
can be parallelized for both partitioned and non-partitioned database objects when no bitmap indexes are
present; in order to parallelize those operations on objects having bitmap indexes, the target table must be
partitioned. Parallel execution of these SQL operations can vastly improve the performance, particularly for
UPDATE, DELETE, or MERGE operations involving large volumes data.
The database administrator can specify that each partition be stored in a separate tablespace; this would allow the
administrator to do backup and recovery operations on each individual partition, independent of the other partitions in
the table.
Moreover, partitioning can reduce scheduled downtime. The performance gains provided by partitioning may enable
database administrators to complete maintenance operations on large database objects in relatively small batch
windows.
Statement of Direction
In every major release since the introduction of the Oracle Partitioning option, Oracle has added new partitioning
methods. Oracle8 introduced range partitioning, Oracle8i introduced hash and composite range-hash partitioning,
Oracle9i introduced list partitioning, and Oracle9i Release2 introduced composite range-list partitioning. Oracle plans
to continue to add new partitioning techniques to ensure that an optimal partitioning technique is available for every
business requirement.
Closing Statement
Oracle9i Partitioning can greatly enhance the manageability, performance, and availability of almost any database
application. Partitioning can be applied to cutting-edge applications and indeed partitioning can be a crucial
technology ingredient to ensure these applications’ success. However, partitioning can also be applied to more
commonplace database applications in order to simplify the administration and costs of managing such applications.
KEY FEATURES
Core Functionality