1© The Pythian Group Inc., 2018
MAY 2018
WHY, WHEN AND HOW TO DO IT
ORACLE
PARTITIONING FOR
DBAS AND
DEVELOPERS
2© The Pythian Group Inc., 2018 2
FRANKY WEBER FAUST
● Senior Oracle Database Consultant at
Pythian
● 27 years old
● Writer at OTNLA and Lore Data Blog
● Speaker at some conferences
● High Availability specialist
● Performance researcher
● Exadata, RAC, DataGuard, Grid
Infrastructure, GoldenGate
© 2017 Pythian. Confidential 3
Years in Business
20 Pythian Experts
in 35 Countries
400+ Current Clients
Globally
350+
4© The Pythian Group Inc., 2018
AGENDA
4
● Partitioning concept
● Background
● Partitioning benefits (Why)
● Implementation scenarios (When)
● Types of partitioning (When)
● Range, List, Interval e Hash partitioning (How)
● The execution plan
● Partitioning maintenance operations*
● Historical data archiving*
● Converting partitions*
© 2017 Pythian. Confidential 5
PARTITIONING CONCEPTS
● Break down a table/index into
smaller pieces
● Partition Key
● Single or multicolumn
● Up to 16 columns
● Unique values are not required
● Every partition is a segment
● Tables
● Heap tables
● Index-organized tables
● Indexes
● Materialized Views
● Clusters
● Performance
● Partition Pruning
© 2017 Pythian. Confidential 6
BACKGROUND HISTORY
● Since Oracle 8
● Requires extra licensing and EE
● Manual partitioning using views
● New features every new release
Oracle 12cR2 Auto-list and Multicolumn list
partitioning, Partitioned
external tables
Table creation for partition exchange,
read-only partitions, Filtered partition
maintenance, Online table
conversion to partitioned table
Oracle 18c Online Merging of Partitions
and Subpartitions
Parallel Partition-Wise
SQL Operations
Modifying the Partitioning
Strategy
Partition Maintenance on multiple
partitions, Asynchronous global
index maintenance, Zone maps
© 2017 Pythian. Confidential 7
PARTITIONING BENEFITS (WHY)
● Increases availability of data
● Eases administration of large
segments
● Might improve the performance of
some queries
● Might reduce contention on hot
OLTP segments
© 2017 Pythian. Confidential 8
IMPLEMENTATION SCENARIOS (WHEN)
● Large volume of data when
administration becomes difficult
● Query performance on large tables
suffers
● Buffer busy waits on high-concurrent
tables
● Horizontal scalability in RAC
● Decreased storage cost
● Compression and row archival
© 2017 Pythian. Confidential 9
TYPES OF PARTITIONING (WHEN)
● Range Partitioning
● Dates and numbers are good
candidates
● Upper boundary
● Hash Partitioning
● High-volume OLTP segments
● Data is evenly distributed across
partitions
● List Partitioning
● Categories, colors, sports, brands
● Default values accepted
● Interval Partitioning
● Automated range partitions
● Reference Partitioning
● Relational model PK-FK
● Interval Reference Partitioning
● All child tables will be automatically
maintained
● Virtual Column Based Partitioning
© 2017 Pythian. Confidential 10
RANGE PARTITIONING (HOW)
© 2017 Pythian. Confidential 11
RANGE PARTITIONING (HOW)
© 2017 Pythian. Confidential 12
LIST PARTITIONING (HOW)
© 2017 Pythian. Confidential 13
LIST PARTITIONING (HOW)
© 2017 Pythian. Confidential 14
HASH PARTITIONING (HOW)
© 2017 Pythian. Confidential 15
HASH PARTITIONING (HOW)
© 2017 Pythian. Confidential 16
HASH PARTITIONING (HOW)
© 2017 Pythian. Confidential 17
HASH PARTITIONING (HOW)
© 2017 Pythian. Confidential 18
HASH PARTITIONING (HOW)
© 2017 Pythian. Confidential 19
HASH PARTITIONING (HOW)
© 2017 Pythian. Confidential 20
HASH PARTITIONING (HOW)
© 2017 Pythian. Confidential 21
HASH PARTITIONING (HOW)
© 2017 Pythian. Confidential 22
HASH PARTITIONING (HOW)
© 2017 Pythian. Confidential 23
HASH PARTITIONING (HOW)
© 2017 Pythian. Confidential 24
HASH PARTITIONING (HOW)
© 2017 Pythian. Confidential 25
INTERVAL PARTITIONING (HOW)
© 2017 Pythian. Confidential 26
INTERVAL PARTITIONING (HOW)
© 2017 Pythian. Confidential 27
INTERVAL PARTITIONING (HOW)
© 2017 Pythian. Confidential 28
INTERVAL PARTITIONING (HOW)
© 2017 Pythian. Confidential 29
INTERVAL PARTITIONING (HOW)
© 2017 Pythian. Confidential 30
THE EXECUTION PLAN
© 2017 Pythian. Confidential 31
THE EXECUTION PLAN
© 2017 Pythian. Confidential 32
THE EXECUTION PLAN
© 2017 Pythian. Confidential 33
THE EXECUTION PLAN
© 2017 Pythian. Confidential 34
THE EXECUTION PLAN
© 2017 Pythian. Confidential 35
PARTITIONING MAINTENANCE OPERATIONS
© 2017 Pythian. Confidential 36
PARTITIONING MAINTENANCE OPERATIONS
© 2017 Pythian. Confidential 37
PARTITIONING MAINTENANCE OPERATIONS
© 2017 Pythian. Confidential 38
CONCLUSION
● Range Partitioning, Hash
Partitioning, List Partitioning, Interval
Partitioning
● 12cR2 onwards can do most
partitioning operations online
● Performance problems in read or
write operations can get better or
worse with partitioning, so plan well
● New releases -> New features, it's
been like that for years.
● Questions?
© 2017 Pythian. Confidential 39
STAY IN TOUCH!
● E-mail: faust@pythian.com
● Blog: http://loredata.com.br/blog
● Facebook: https://facebook.com/08Franky.Weber
● Twitter: https://twitter.com/frankyweber
● LinkedIn: https://linkedin.com/in/frankyweber/en
● Oracle ACE profile: https://apex.oracle.com/pls/apex/f?p=19297:4:::NO:4:P4_ID:17002

Oracle Partitioning for DBAs and Developers

  • 1.
    1© The PythianGroup Inc., 2018 MAY 2018 WHY, WHEN AND HOW TO DO IT ORACLE PARTITIONING FOR DBAS AND DEVELOPERS
  • 2.
    2© The PythianGroup Inc., 2018 2 FRANKY WEBER FAUST ● Senior Oracle Database Consultant at Pythian ● 27 years old ● Writer at OTNLA and Lore Data Blog ● Speaker at some conferences ● High Availability specialist ● Performance researcher ● Exadata, RAC, DataGuard, Grid Infrastructure, GoldenGate
  • 3.
    © 2017 Pythian.Confidential 3 Years in Business 20 Pythian Experts in 35 Countries 400+ Current Clients Globally 350+
  • 4.
    4© The PythianGroup Inc., 2018 AGENDA 4 ● Partitioning concept ● Background ● Partitioning benefits (Why) ● Implementation scenarios (When) ● Types of partitioning (When) ● Range, List, Interval e Hash partitioning (How) ● The execution plan ● Partitioning maintenance operations* ● Historical data archiving* ● Converting partitions*
  • 5.
    © 2017 Pythian.Confidential 5 PARTITIONING CONCEPTS ● Break down a table/index into smaller pieces ● Partition Key ● Single or multicolumn ● Up to 16 columns ● Unique values are not required ● Every partition is a segment ● Tables ● Heap tables ● Index-organized tables ● Indexes ● Materialized Views ● Clusters ● Performance ● Partition Pruning
  • 6.
    © 2017 Pythian.Confidential 6 BACKGROUND HISTORY ● Since Oracle 8 ● Requires extra licensing and EE ● Manual partitioning using views ● New features every new release Oracle 12cR2 Auto-list and Multicolumn list partitioning, Partitioned external tables Table creation for partition exchange, read-only partitions, Filtered partition maintenance, Online table conversion to partitioned table Oracle 18c Online Merging of Partitions and Subpartitions Parallel Partition-Wise SQL Operations Modifying the Partitioning Strategy Partition Maintenance on multiple partitions, Asynchronous global index maintenance, Zone maps
  • 7.
    © 2017 Pythian.Confidential 7 PARTITIONING BENEFITS (WHY) ● Increases availability of data ● Eases administration of large segments ● Might improve the performance of some queries ● Might reduce contention on hot OLTP segments
  • 8.
    © 2017 Pythian.Confidential 8 IMPLEMENTATION SCENARIOS (WHEN) ● Large volume of data when administration becomes difficult ● Query performance on large tables suffers ● Buffer busy waits on high-concurrent tables ● Horizontal scalability in RAC ● Decreased storage cost ● Compression and row archival
  • 9.
    © 2017 Pythian.Confidential 9 TYPES OF PARTITIONING (WHEN) ● Range Partitioning ● Dates and numbers are good candidates ● Upper boundary ● Hash Partitioning ● High-volume OLTP segments ● Data is evenly distributed across partitions ● List Partitioning ● Categories, colors, sports, brands ● Default values accepted ● Interval Partitioning ● Automated range partitions ● Reference Partitioning ● Relational model PK-FK ● Interval Reference Partitioning ● All child tables will be automatically maintained ● Virtual Column Based Partitioning
  • 10.
    © 2017 Pythian.Confidential 10 RANGE PARTITIONING (HOW)
  • 11.
    © 2017 Pythian.Confidential 11 RANGE PARTITIONING (HOW)
  • 12.
    © 2017 Pythian.Confidential 12 LIST PARTITIONING (HOW)
  • 13.
    © 2017 Pythian.Confidential 13 LIST PARTITIONING (HOW)
  • 14.
    © 2017 Pythian.Confidential 14 HASH PARTITIONING (HOW)
  • 15.
    © 2017 Pythian.Confidential 15 HASH PARTITIONING (HOW)
  • 16.
    © 2017 Pythian.Confidential 16 HASH PARTITIONING (HOW)
  • 17.
    © 2017 Pythian.Confidential 17 HASH PARTITIONING (HOW)
  • 18.
    © 2017 Pythian.Confidential 18 HASH PARTITIONING (HOW)
  • 19.
    © 2017 Pythian.Confidential 19 HASH PARTITIONING (HOW)
  • 20.
    © 2017 Pythian.Confidential 20 HASH PARTITIONING (HOW)
  • 21.
    © 2017 Pythian.Confidential 21 HASH PARTITIONING (HOW)
  • 22.
    © 2017 Pythian.Confidential 22 HASH PARTITIONING (HOW)
  • 23.
    © 2017 Pythian.Confidential 23 HASH PARTITIONING (HOW)
  • 24.
    © 2017 Pythian.Confidential 24 HASH PARTITIONING (HOW)
  • 25.
    © 2017 Pythian.Confidential 25 INTERVAL PARTITIONING (HOW)
  • 26.
    © 2017 Pythian.Confidential 26 INTERVAL PARTITIONING (HOW)
  • 27.
    © 2017 Pythian.Confidential 27 INTERVAL PARTITIONING (HOW)
  • 28.
    © 2017 Pythian.Confidential 28 INTERVAL PARTITIONING (HOW)
  • 29.
    © 2017 Pythian.Confidential 29 INTERVAL PARTITIONING (HOW)
  • 30.
    © 2017 Pythian.Confidential 30 THE EXECUTION PLAN
  • 31.
    © 2017 Pythian.Confidential 31 THE EXECUTION PLAN
  • 32.
    © 2017 Pythian.Confidential 32 THE EXECUTION PLAN
  • 33.
    © 2017 Pythian.Confidential 33 THE EXECUTION PLAN
  • 34.
    © 2017 Pythian.Confidential 34 THE EXECUTION PLAN
  • 35.
    © 2017 Pythian.Confidential 35 PARTITIONING MAINTENANCE OPERATIONS
  • 36.
    © 2017 Pythian.Confidential 36 PARTITIONING MAINTENANCE OPERATIONS
  • 37.
    © 2017 Pythian.Confidential 37 PARTITIONING MAINTENANCE OPERATIONS
  • 38.
    © 2017 Pythian.Confidential 38 CONCLUSION ● Range Partitioning, Hash Partitioning, List Partitioning, Interval Partitioning ● 12cR2 onwards can do most partitioning operations online ● Performance problems in read or write operations can get better or worse with partitioning, so plan well ● New releases -> New features, it's been like that for years. ● Questions?
  • 39.
    © 2017 Pythian.Confidential 39 STAY IN TOUCH! ● E-mail: faust@pythian.com ● Blog: http://loredata.com.br/blog ● Facebook: https://facebook.com/08Franky.Weber ● Twitter: https://twitter.com/frankyweber ● LinkedIn: https://linkedin.com/in/frankyweber/en ● Oracle ACE profile: https://apex.oracle.com/pls/apex/f?p=19297:4:::NO:4:P4_ID:17002