oracle table partitioning - introduction

Download Oracle Table Partitioning  - Introduction

If you can't read please download the document

Upload: myonlineitcourses

Post on 16-Apr-2017

15.146 views

Category:

Technology


0 download

TRANSCRIPT

Performance tuning - Partitioning

Oracle Partitioning -- A Primer

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comPartitioning

Partitioning is the ability of the database to take very large tables or indexes and physically break them into smallermanageable pieces.

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.com

Oracle9i Database Administration Fundamentals I 4-#

Partitioned VS Non Partitioned Table

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comPartitions - BenefitsLarge TableDifficult to ManagePartitionDivide and ConquerEasier to ManageImprove PerformanceComposite PartitionBetter PerformanceMore flexibility to match business needsJANFEBUSAEUROPEORDERSTransparent to applications

ORDERS

JANFEBORDERS

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comPartitioning - BenefitsFasterQueries will access only those relevant partitions

CheaperAn entire partition can be exportedExported partition can be deleted from databaseFlexiblePartition Maintenance is simpler when compared to a large un-partitioned tablePartition backup/restoration is easier

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.com

Oracle9i Database Administration Fundamentals I 4-#

When To Partition - Table

Here are some suggestions for when to partition a table:

Tables greater than 2 GB should always be considered as candidates for partitioning.

Tables containing historical data, in which new data is added into the newest partition. A typical example is a historical table where only the current month's data is updatable and the other 11 months are read only.When the contents of a table need to be distributed across different types of storage devices.

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comPartition Strategies

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.com

Oracle9i Database Administration Fundamentals I 4-#

Partition Type .. (Examples)

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comhttp://download.oracle.com/docs/cd/B28359_01/server.111/b32024/partition.htmOracle9i Database Administration Fundamentals I 4-#

Range Partitioned Tables

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.com

Oracle9i Database Administration Fundamentals I 4-#

DDL Example

CREATE TABLE DEPT (DEPTNO NUMBER (2),DEPT_NAME VARCHAR2 (30))PARTITION BY RANGE (DEPTNO)(PARTITION D1 VALUES LESS THAN (10) TABLESPACE DEPT1,PARTITION D2 VALUES LESS THAN (20) TABLESPACE DEPT2,PARTITION D1 VALUES LESS THAN (MAXVALUE) TABLESPACE DEPT3)

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.com

Oracle9i Database Administration Fundamentals I 4-#

Range Partition (Multi column)

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comAll partitions, except the first, have an implicit low value specified by the VALUES LESS THAN literal on the previous partition. Any binary values of the partition key equal to or higher than this literal are added to the next higher partition. Highest partition being where MAXVALUE literal is defined. Keyword, MAXVALUE, represents a virtual infinite value that sorts higher than any other value for the data type, including the null value.

Oracle9i Database Administration Fundamentals I 4-#

When to use Range Partition

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comHash Partitioning

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.com

Oracle9i Database Administration Fundamentals I 4-#

Hash Partition Example Hash-partitioned table that splits the table into four parts based on the hash of the partition key, acct_no.CREATE TABLE CUST_SALES_HASH (ACCT_NO NUMBER (5),CUST_NAME CHAR (30))PARTITION BY HASH (ACCT_NO) PARTITIONS 4 STORE IN (USERS1, USERS2, USERS3, USERS4);

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.com

Oracle9i Database Administration Fundamentals I 4-#

When to use Hash Partition

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comList Partitioning

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.com

Oracle9i Database Administration Fundamentals I 4-#

Range ,List , Hash Partitions

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comComposite Partitioning

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comComposite Partitioning StrategiesNew 11g StrategyUse CaseList RangeGeography TimeRange - RangeShip Date Order DateList - HashGeography OrderIDList - ListGeography Product

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comRange List Partitioning

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comComposite PartitioningRange - Range

Jan 2006

......Feb 2006Mar 2006Jan 2007

......

......

............

Jan 2006Feb 2006May 2006

Mar 2006

All records with order_date in March 2006 ANDship_date in May 2006

May2006ship_dateorder_dateTable SALESRANGE(order_date)-RANGE(ship_date)

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comWould like to learn more about oracle ???

# MyOnlineITCourses.com# MyOnlineITCourses.com

#MyOnlineITCourses.com

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.comwww.MyOnlineITCourses.comWe give quality online trainings by IT Professionals forOracle SQL , PL/SQLOracle DBAOracle Performance TuningData Modelling with Erwin ToolTo get more details contact us [email protected] +91 991 2323 000 www.Facebook.com/MyOnlineITCourses

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.com

#MyOnlineITCourses.com#MyOnlineITCourses.com#MyOnlineITCourses.com

Oracle9i Database Administration Fundamentals I 4-#