partitioning beyond basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. plan_table revisited...
TRANSCRIPT
![Page 1: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/1.jpg)
PartitioningBeyond
the BasicsArup Nanda
Starwood Hotels & ResortsWhite Plains, NY
![Page 2: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/2.jpg)
DynamicBreadArtist
![Page 3: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/3.jpg)
What’s It
• Divide and Conquer• The Best Thing Since Sliced Bread
![Page 4: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/4.jpg)
Partition
• Partition Elimination• Parallel Execution• Partition Exchange• Deletion• Archiving
![Page 5: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/5.jpg)
Partition Views
View Created asSELECT some fieldsFROM Table1UNION ALLSELECT same fieldsFROM Table2
Table A
Table B
View
![Page 6: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/6.jpg)
Problem
While INSERTINGTable A
Table B
Row1 View
![Page 7: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/7.jpg)
Real Partitions
• Came Out with Oracle 8.0• Range Partitioned Only• Partition Key Column
– VALUES LESS THAN (CONSTANT)
Partition A
Partition B
Main Table
![Page 8: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/8.jpg)
Hash Partitions
• Where Range is Not Practical• Performance
Partition1
Partition2
Row1HashFunc
![Page 9: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/9.jpg)
Composite Partitioning
• Partitions are subdivided• Range-Hash• Range-List Partition1
Partition2
Subpart1
Subpart2
Subpart1
Subpart2
![Page 10: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/10.jpg)
More Techie
In V$SESSION_WAIT: ‘latch wait’Latch: “cache buffer chain latch”More Accesses to a Segment = Need More
LatchesPartitioning More Segments per Object
Less Accesses per Segment Less “cache buffer chain latch” contention
![Page 11: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/11.jpg)
List Partitioning
Similar to Range but Values are DiscretePARTITION BY LIST (STATE_CODE)
(
PARTITION P1 VALUES (‘CT’,’NY’),
PARTITION P2 VALUES (‘NJ’),
PARTITION PM VALUES (DEFAULT)
)
Multi-column not supported
![Page 12: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/12.jpg)
Local Index
• Partitioning Schemesof Index and Table areSame
• Easy to Administer• REBUILD part by part
Table
Index
![Page 13: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/13.jpg)
Global Indexes
• Indexes That SpanAcross All Rows of AllPartitions
• Typically Used toEnforce Primary Keys
Index
Oracle 10g: Global Index can be Hash Partitioned
![Page 14: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/14.jpg)
Equi-Partitioning
If a Table and another Tableare partitioned in exactlysame way with the samePartitioning Key
E.g.SALES on ORDER_DATEORDERS on ORDER_DATE
TableB
TableA
![Page 15: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/15.jpg)
SALES
![Page 16: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/16.jpg)
QTR1 QTR2 QTR3 DEFAULT
SALES
PARTITIONS
![Page 17: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/17.jpg)
DEFAULT
QTR1 QTR2 QTR3 DEFAULT
CUST3
CUST2
CUST1
DEFAULT
CUST3
CUST2
CUST1
DEFAULT
CUST3
CUST2
CUST1
DEFAULT
CUST3
CUST2
CUST1
SALES
PARTITIONS
SUBPARTITIONS
![Page 18: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/18.jpg)
DEFAULT
QTR1 QTR2 QTR3 DEFAULTCUST3
CUST2
CUST1
DEFAULT
CUST3
CUST2
CUST1
DEFAULT
CUST3
CUST2
CUST1
DEFAULT
CUST3
CUST2
CUST1
TAB
ANALYZE
![Page 19: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/19.jpg)
DEFAULT
QTR1 QTR2 QTR3 DEFAULTCUST3
CUST2
TAB
DEFAULT
CUST3
CUST2
DEFAULT
CUST3
CUST2
CUST1
DEFAULT
CUST3
CUST2
CUST1CUST1 CUST1
![Page 20: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/20.jpg)
DEFAULT
QTR1 QTR2 QTR3 DEFAULTCUST3
CUST2
CUST1
DEFAULT
CUST3
CUST2
CUST1
DEFAULT
CUST3
CUST2
CUST1
DEFAULT
CUST3
CUST2
CUST1
DEFAULT
QTR1 QTR2 QTR3 DEFAULTCUST3
CUST2
CUST1
DEFAULT
CUST3
CUST2
CUST1
DEFAULT
CUST3
CUST2
CUST1
DEFAULT
CUST3
CUST2
CUST1
TAB
IND
TABLE
INDEX
replace
replace
![Page 21: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/21.jpg)
DEFAULT
QTR1 QTR2 QTR3 DEFAULTCUST3
CUST2
TAB
DEFAULT
CUST3
CUST2
DEFAULT
CUST3
CUST2
DEFAULT
CUST3
CUST2
DEFAULT
QTR1 QTR2 QTR3 DEFAULTCUST3
CUST2
IND
DEFAULT
CUST3
CUST2
DEFAULT
CUST3
CUST2
DEFAULT
CUST3
CUST2
CUST1
CUST1
TABLE
INDEX
CUST1
CUST1
CUST1 CUST1
CUST1 CUST1
![Page 22: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/22.jpg)
Subpartitioning
Select from a partition bySELECT … FROM TAB1 PARTITION (P1);
Select from a subpartition bySELECT … FROM TAB1 SUBPARTITION (SP1);
Works for Insert/Update/Delete, SQL*LoaderINTO TABLE TAB1 SUBPARTITION (SP1)
And Export, too TABLE=MYTAB1:SP1
![Page 23: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/23.jpg)
Subpartitioning …
DBA_SEGMENTSSELECT * FROM DBA_SEGMENTS
WHERE TABLE_NAME = ‘TAB1’
AND PARTITION_NAME = ‘SP1’
/
SEGMENT_TYPEPARTITION_ID
![Page 24: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/24.jpg)
SubpartitionsSubpartition Templates
PARTITION BY RANGE (COL1)SUBPARTITION BY HASH (COL2)SUBAPARTITION TEMPLATE(
SUBPARTITION SP1 TABLESPACE T1,SUBPARTITION SP2 TABLESPACE T2
)(
PARTITION P1 VALUES LESS THAN (101),PARTITION P2 VALUES LESS THAN (201),
…
P1_SP1, P1_SP2, P2_SP1, P2_SP2Can’t Specify Storage (8i)Can specify Storage (9i) DBA_SUBPARTITION_TEMPLATES
![Page 25: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/25.jpg)
Partition Pruning
Partition Based on Date – 1 partition per quarterSELECT … FROM SALES
WHERE ORDER_DATE = ‘1/1/2003’
Will search only the 2003 Q1 partition
ptest1 ins_ptest1; ptest2
![Page 26: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/26.jpg)
Plan_Table Revisited
Relvant ColumnsPARTITION_STARTPARTITION_STOPPARTITION_ID
The step id that decided the partition start and stopFILTER_PREDICATES
The exact condition used to evaluate partitions
![Page 27: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/27.jpg)
Dbms_xplan
dbms_xplan.display (
‘plan_table’,/* plan table name */NULL,/* statement id */
‘BASIC’,/* format */ ‘TYPICAL’,‘ALL’,‘SERIAL’ )
select * from
table (
)
![Page 28: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/28.jpg)
Partition Wise JoinsEqui-partioned tables
SALES partitioned on SALES_DATEREVENUE partitioned on BOOKED_DATESELECT … FROM SALES S, REVENUE RWHERE S.SALES_DATE = R.BOOKED_DATE
REVENUESALES
Partition1Partition2Partition3
Partition1Partition2Partition3
•Ptest3a ptest3b
![Page 29: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/29.jpg)
Partitionwise Join
• Hash Partitioned Tables• Elimination will occur in Equality only, not in
range.
Ptest3ha ptest3hb
![Page 30: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/30.jpg)
Character Values in RangeCREATE TABLE EMPLOYEE (…………)
PARTITION BY RANGE (LAST_NAME)
(
PARTITION P1 VALUES LESS THAN (‘D%’),
PARTITION P2 VALUES LESS THAN (‘M%’),
PARTITION P3 VALUES LESS THAN (‘T%’),
PARTITION PM VALUES LESS THAN (MAXVALUE)
)
ptest4a, ptest4b, ins_ptest4
![Page 31: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/31.jpg)
Multi-column KeysCol1 col2--- ---- ----- 50 50 rec1150 150 rec2 50 150 rec3150 50 rec4101 50 rec5101 101 rec6101 150 rec7201 50 rec8201 101 rec9201 201 rec10
p1p2p2p2p2p2
partition by range (col1,col2)
(partition p1 valuesless than (101, 101),
partition p2 values lessthan (201, 201),
partition pm values lessthan
(maxvalue, maxvalue))
ptab1
p2pmpmpm
![Page 32: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/32.jpg)
Multi-Column Decision
Consider 1st Column
< Boundary
Value
= Boundary
Value
1st Partition Consider 2nd Column
< Boundary
Value
2nd Partition 3rd Partition
Y
N
Y
NY
![Page 33: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/33.jpg)
Deciding Partition Key
• Performance – Elimination/Join, etc.• Backup• Other Manageability
![Page 34: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/34.jpg)
Converting to Partitioning
Oracle Recommended (MetaLink Note 1070693.6)
• Create the partitoned table and Insert• Create Table As Select (CTAS)• Create Small Tables and Exchange Partitions• PROBLEM: Space Requirement and Time
![Page 35: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/35.jpg)
Alternatives
• Oracle 9i Online Redefinition– Small Downtime– Space Needed– Oracle 9i
• Materialized View Method– CREATE MATERIALIZED VIEW MV1 ON
PREBUILT TABLE ….– DROP MATERIALIZED VIEW
![Page 36: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/36.jpg)
Split-Split Method
• Create partitioned table exactly same as sourcetable with one partition with MAXVALUE
• Exchange source table with this partition• Split this partition at the lowest boundary• Split the maximum partition at the next boundary• Repeat till all partitions are created
![Page 37: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/37.jpg)
Example
Table NOPARTCOL1 NUMBERCOL2 VARCHAR2(10)COL3 CHAR(2)
Index IN_NOPART(COL2)
Constraint CK_NOPART(COL3 IS NOT NULL)
Partitioned BY RANGE (COL1)P1 LESS THAN (101)P2 LESS THAN (201)P3 LESS THAN (301)P4 LESS THAN (401)PM … (MAXVALUE)
Table PARTTable, Index, Constraint
Name Change
![Page 38: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/38.jpg)
Summary• Create table part …• Exchange partition pMAX with table NOPART• Split partition pMAX repeatedly• Drop original table nopart• Rename part to no part• Rename index to in_nopart• Rename constraint to ck_nopart
![Page 39: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/39.jpg)
Pros & Cons
• Space Needs – Less• Redo Log Generation – Minimized• Time – Less• Concurrency – Higher• Time – Still High• Concurency – Still Low
![Page 40: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/40.jpg)
Exchanging Partitions
Main TablePartition p1
Subpartition sp1Subpartition sp2Subpartition sp3
),…
Source Tablepartition p1partition p2partition p3
![Page 41: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/41.jpg)
Subpartition Statistics
• DBMS_STATS.GATHER_TABLE_STATS– tabname => ‘MYTABLE’– partname => ‘P1’– granularity =>
• DEFAULT• GLOBAL• PARTITION• SUBPARTITION• ALL
Spart1.sql
![Page 42: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/42.jpg)
Statistics Collection
YESYESYESYESALLYESYESNONOSUBPARTITIONNOYESYESYESDEFAULTNOYESYESNOPARTITIONNONONOYESGLOBAL
SubpartStats
PartitionStats
PartitionGlobal
TableGlobal
Granularity
![Page 43: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/43.jpg)
Parallel Index Rebuilding
– One Query Server per Partition– Slows down processing– Can’t exploit the Parallel Processing Capabilities
q1 q2
QC
q3 q4
![Page 44: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/44.jpg)
Parallel Index Rebuilding
DBMS_PCLXUTIL.BUILD_PART_INDEXjobs_per_batch NUMBER DEFAULT 1procs_per_job NUMBER DEFAULT 1tab_name VARCHAR2idx_name VARCHAR2force_opt BOOLEAN DEFAULT FALSE
![Page 45: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/45.jpg)
The Rule Based Optimizer
• Invokes CBO• Makes Up Statistics• Don’t Use Partitioning if RBO is Used
![Page 46: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/46.jpg)
Coalesce –vs- Merge
• Coalesce – Hash Partitions• Merge – Range and List
coalesce
merge
![Page 47: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/47.jpg)
Oracle 10g Enhancements
• Partitioned Index Organized Tables (IOT)– List Partitioning Possible– Bitmap Index Support– Global Index Maintenance
• Hash Partitioning of Indexes– On Partitioned Tables– On Index Organized Tables– On Regular Tables
![Page 48: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/48.jpg)
Hash Partitioned Index
Block1 Block2 Block3 Block4Table
Block10 Block11 Block12 Block13Index
Block10 Block11 Block12 Block13IndexPart1 Part2 Part3 Part4
![Page 49: Partitioning Beyond Basics · 2009. 3. 4. · ptest1 ins_ptest1; ptest2. Plan_Table Revisited Relvant Columns PARTITION_START PARTITION_STOP PARTITION_ID The step id that decided](https://reader031.vdocuments.net/reader031/viewer/2022011921/602fc077da0a0e7b9e7b4a3a/html5/thumbnails/49.jpg)
Thank You
Questions?More Resources:
www.proligence.com