Oracle Table Partitioning - Introduction

  • 11,577 views
Uploaded on

Introduction to Oracle Table partitioning .Covers information about " What , Why, When , How" aspects of Oracle Table partitioning.

Introduction to Oracle Table partitioning .Covers information about " What , Why, When , How" aspects of Oracle Table partitioning.

More in: Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Explained with suitable and easy examples....
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
11,577
On Slideshare
0
From Embeds
0
Number of Embeds
14

Actions

Shares
Downloads
337
Comments
1
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Oracle Partitioning -- A Primer 1 1 MyOnlineITCourses.com MyOnlineITCourses.com
  • 2. PartitioningPartitioning is the ability of the database to take very large tables or indexes and  physically break them into  smaller  manageable pieces. 2 2 MyOnlineITCourses.com MyOnlineITCourses.com
  • 3. Partitioned VS Non Partitioned Table 3 3 MyOnlineITCourses.com MyOnlineITCourses.com
  • 4. Partitions - Benefits ORDERS ORDERS ORDERS USA EUROPE JAN FEB JAN FEB Large Table Partition Composite PartitionDifficult to Manage Divide and Conquer Better Performance Easier to Manage More flexibility to match business needs Improve Performance Transparent to applications 4 4 MyOnlineITCourses.com MyOnlineITCourses.com
  • 5. Partitioning - Benefits • Queries will access only those relevant partitionsFaster • An entire partition can be exported • Exported partition can be deleted fromCheaper database • Partition Maintenance is simpler when compared to a large un-partitioned tableFlexible • Partition backup/restoration is easier 5 5 MyOnlineITCourses.com MyOnlineITCourses.com
  • 6. 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 months 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. 6 6 MyOnlineITCourses.com MyOnlineITCourses.com
  • 7. Partition Strategies 7 7 MyOnlineITCourses.com MyOnlineITCourses.com
  • 8. Partition Type .. (Examples) 8 8 MyOnlineITCourses.com MyOnlineITCourses.com
  • 9. Range Partitioned Tables • Data distribution is based on range of values • Data distribution is continuousDefinition • Best performance when data distribution is even on the partition key. • Knowledge of data is critical before choosing this • Date as partitioning key Jan 2011, Feb 2011, Mar 2011 so on..Example • Department code as partitioning key Values <= 30, Values > 30 9 9 MyOnlineITCourses.com MyOnlineITCourses.com
  • 10. 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) 10 10 MyOnlineITCourses.com MyOnlineITCourses.com
  • 11. Range Partition (Multi column) • Defined on two or more columns of the tableMulti Column Range Partition • Enhances Query performance if searched on partition key • Improves the Manageability of Advantages partitions 11 11 MyOnlineITCourses.com MyOnlineITCourses.com
  • 12. When to use Range Partition Very less time Very large for tables being administrative scanned on a operations likerange predicate backup on largelike Order-Date tables Need to maintain rolling window of data 12 12 MyOnlineITCourses.com MyOnlineITCourses.com
  • 13. Hash Partitioning Specify the Oracle Specify Always Define 2n Partitions number of database storage forPartition Key partitions inserts the entire Storage rows table and based on the hash value tablespace of partition for key partitions 13 13 MyOnlineITCourses.com MyOnlineITCourses.com
  • 14. Hash Partition – ExampleHash-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); 14 14 MyOnlineITCourses.com MyOnlineITCourses.com
  • 15. When to use Hash Partition Improve Manageability/availability of Large tables Avoid data skew in partitions Maximize I/0 throughput 15 15 MyOnlineITCourses.com MyOnlineITCourses.com
  • 16. List Partitioning •Segmenting data with a list of values •Flexible means of partitioning where data is better understoodDefinition • Similar to Range Partitioning, but without any max value • CREATE TABLE DEPT_PART (DEPTNO NUMBER (2),DNAME VARCHAR2 (14),LOC VARCHAR2 (13)) PARTITION BY LIST (DNAME) (PARTITION D1_EAST VALUES (‘NEW YORK’),Example PARTITION D2_WEST VALUES (‘SAN FRANCISCO’, ‘LOS ANGELES’), PARTITION D3_SOUTH VALUES (‘ATLANTA’,’DALLAS’,’HOUSTON’), PARTITION D4_NORTH VALUES (‘CHICAGO’,’DETROIT’)); 16 16 MyOnlineITCourses.com MyOnlineITCourses.com
  • 17. Range ,List , Hash Partitions 17 17 MyOnlineITCourses.com MyOnlineITCourses.com
  • 18. Composite Partitioning A distinct value Composite pair for the two Data is Partitioning is dimensions Partitioned complementary uniquely along two to multi determines thedimensions column range target partition partition 18 18 MyOnlineITCourses.com MyOnlineITCourses.com
  • 19. Composite Partitioning Strategies New 11g Strategy Use CaseList – Range Geography –TimeRange - Range Ship Date – Order DateList - Hash Geography – OrderIDList - List Geography – Product 19 19 MyOnlineITCourses.com MyOnlineITCourses.com
  • 20. Range – List Partitioning 20 20 MyOnlineITCourses.com MyOnlineITCourses.com
  • 21. Composite Partitioning Table SALES Range - Range RANGE(order_date)-RANGE(ship_date)ship_date • All records with Jan order_date in 2006 ... ... March 2006 AND Feb ship_date in May 2006 ... ... 2006 ... ... May May 2006 ... ... ... ... Jan 2006 Feb 2006 Mar 2006 Mar 2006 Jan 2007 order_date 21 21 MyOnlineITCourses.com MyOnlineITCourses.com
  • 22. Would like to learn more about oracle ??? 22 22 MyOnlineITCourses.com MyOnlineITCourses.com
  • 23. www.MyOnlineITCourses.com We give quality online trainings by IT Professionals for  Oracle SQL , PL/SQL  Oracle DBA  Oracle Performance Tuning  Data Modelling with Erwin Tool To get more details contact us  info@myonlineitcourses.com  +91 991 2323 000  www.Facebook.com/MyOnlineITCourses 23 23 MyOnlineITCourses.com MyOnlineITCourses.com
  • 24. 2424 MyOnlineITCourses.com MyOnlineITCourses.com