Presentation is loading. Please wait.

Presentation is loading. Please wait.

1  MyOnlineITCourses.com 1 MyOnlineITCourses.com Oracle Partitioning -- A Primer.

Similar presentations


Presentation on theme: "1  MyOnlineITCourses.com 1 MyOnlineITCourses.com Oracle Partitioning -- A Primer."— Presentation transcript:

1 1  MyOnlineITCourses.com 1 MyOnlineITCourses.com Oracle Partitioning -- A Primer

2 2  MyOnlineITCourses.com 2 MyOnlineITCourses.com Partitioning Partitioning is the ability of the database to take very large tables or indexes and physically break them into  smaller  manageable pieces.

3 3  MyOnlineITCourses.com 3 MyOnlineITCourses.com Partitioned VS Non Partitioned Table

4 4  MyOnlineITCourses.com 4 MyOnlineITCourses.com Partitions - Benefits Large Table Difficult to Manage Partition Divide and Conquer Easier to Manage Improve Performance Composite Partition Better Performance More flexibility to match business needs JANFEB USA EUROPE ORDERS Transparent to applications ORDERS JANFEB ORDERS

5 5  MyOnlineITCourses.com 5 MyOnlineITCourses.com Partitioning - Benefits Faster Queries will access only those relevant partitions Cheaper An entire partition can be exported Exported partition can be deleted from database Flexible Partition Maintenance is simpler when compared to a large un-partitioned table Partition backup/restoration is easier

6 6  MyOnlineITCourses.com 6 MyOnlineITCourses.com 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.

7 7  MyOnlineITCourses.com 7 MyOnlineITCourses.com Partition Strategies

8 8  MyOnlineITCourses.com 8 MyOnlineITCourses.com Partition Type.. (Examples)

9 9  MyOnlineITCourses.com 9 MyOnlineITCourses.com Range Partitioned Tables Data distribution is based on range of values Data distribution is continuous Best performance when data distribution is even on the partition key. Knowledge of data is critical before choosing this Definition Date as partitioning key Jan 2011, Feb 2011, Mar 2011 so on.. Department code as partitioning key Values 30 Example

10 10  MyOnlineITCourses.com 10 MyOnlineITCourses.com 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 )

11 11  MyOnlineITCourses.com 11 MyOnlineITCourses.com Range Partition (Multi column) Defined on two or more columns of the table Multi Column Range Partition Enhances Query performance if searched on partition key Improves the Manageability of partitions Advantages

12 12  MyOnlineITCourses.com 12 MyOnlineITCourses.com When to use Range Partition Very large tables being scanned on a range predicate like Order-Date Need to maintain rolling window of data Very less time for administrative operations like backup on large tables

13 13  MyOnlineITCourses.com 13 MyOnlineITCourses.com Hash Partitioning Partition Key Specify the number of partitions Always Define 2 n Partitions Oracle database inserts rows based on hash value of partition key Storage Specify storage for the entire table and the tablespace for partitions

14 14  MyOnlineITCourses.com 14 MyOnlineITCourses.com 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);

15 15  MyOnlineITCourses.com 15 MyOnlineITCourses.com When to use Hash Partition Improve Manageability/availability of Large tables Avoid data skew in partitions Maximize I/0 throughput

16 16  MyOnlineITCourses.com 16 MyOnlineITCourses.com List Partitioning Segmenting data with a list of values Flexible means of partitioning where data is better understood Similar to Range Partitioning, but without any max value Definition CREATE TABLE DEPT_PART (DEPTNO NUMBER (2),DNAME VARCHAR2 (14),LOC VARCHAR2 (13)) PARTITION BY LIST (DNAME) (PARTITION D1_EAST VALUES (‘NEW YORK’), PARTITION D2_WEST VALUES (‘SAN FRANCISCO’, ‘LOS ANGELES’), PARTITION D3_SOUTH VALUES (‘ATLANTA’,’DALLAS’,’HOUSTON’), PARTITION D4_NORTH VALUES (‘CHICAGO’,’DETROIT’)); Example

17 17  MyOnlineITCourses.com 17 MyOnlineITCourses.com Range,List, Hash Partitions

18 18  MyOnlineITCourses.com 18 MyOnlineITCourses.com Composite Partitioning Data is Partitioned along two dimensions A distinct value pair for the two dimensions uniquely determines the target partition Composite Partitioning is complementary to multi column range partition

19 19  MyOnlineITCourses.com 19 MyOnlineITCourses.com Composite Partitioning Strategies New 11g StrategyUse Case List – RangeGeography –Time Range - RangeShip Date – Order Date List - HashGeography – OrderID List - ListGeography – Product

20 20  MyOnlineITCourses.com 20 MyOnlineITCourses.com Range – List Partitioning

21 21  MyOnlineITCourses.com 21 MyOnlineITCourses.com Composite Partitioning Range - Range Jan 2006... Feb 2006Mar 2006Jan 2007... Jan 2006 Feb 2006 May 2006 Mar 2006 All records with order_date in March 2006 AND ship_date in May 2006 May 2006 ship_date order_date Table SALES RANGE(order_date)-RANGE(ship_date)‏

22 22  MyOnlineITCourses.com 22 MyOnlineITCourses.com Would like to learn more about oracle ???

23 23  MyOnlineITCourses.com 23 MyOnlineITCourses.com 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

24 24  MyOnlineITCourses.com 24 MyOnlineITCourses.com


Download ppt "1  MyOnlineITCourses.com 1 MyOnlineITCourses.com Oracle Partitioning -- A Primer."

Similar presentations


Ads by Google