Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Jaromir.

Asked: March 17, 2009 - 2:22 pm UTC

Last updated: October 11, 2018 - 3:01 pm UTC

Version: 11.1.0

Viewed 1000+ times

You Asked

Hi Tom,

The 11g release did nicely complete (nearly all) possible combination of composite partitioning schema. The missing hash - hash partitioning schema is probably not very interesting.

The question is, does it mean that the development of partitioning reach the final stage? I don't thing so. What will be the next big step? An other partitioning schema, sub-sub partitioning or introduction of dynamical partitioning levels?

It will be nice to know your opinion.

regards,

Jaromir D.B. Nemec

and Tom said...

Well, over 10 years, a lot has been added to partitioning:

Oracle 8 - introduced it, range partitioning. global range indexes, static partition pruning, basic operations - add, drop, exchange

8i - hash and composite range/hash. partition wise joins, dynamic partition elimination, merging

9i - list partitioning, global index maintenance during administrative operations.

10g - global hash indexes, local index maintenance during administrative operations.

10gr2 - 1m partitions/table, multi-dimensional partition pruning

11g -
o more composite choices (as you noted)

o REF partitioning (foreign key partitioning, the ability to really do rolling windows with parent/child tables, child is partitioned by rules on parent, you can truncate/drop child and parent partitions - something you could not before)

o Interval partitiong

o Virtual column partitioning (partition by a function)

o Partition Advisor




So, what else could they add?

How about (just my opinion, not a statement of direction)

o interval partitioning that works with reference partitioning. Right now, if you reference partition, you cannot interval.

o single step process to convert a non-partitioned table into the first populated partition of a partitioned table

o split a single partition into N (where N > 2) in a single pass.

o ability to specify a 'rule' to name interval partitions as they are created

o ability to transport a partition

o new type of interval partition, a "fill me with so much data and then mark the end of my range and create a new partition".

o a fast merge partition, why move any of the rows? could we just re-allocate the extents from the old segment to the new segment if they are in the same tablespace (harder than it sounds)

and so on.



I remember when version 7.3.4 came out - I looked at the list of features and said "gosh, we are done, what else could you possibly add to the database that would be useful...."

I'm very glad they didn't stop - I cannot imagine using a database as rudimentary as 7.3.4 was, at the time it seemed finished though...

Rating

  (10 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Another Suggestion

Greg, March 19, 2009 - 10:44 am UTC

Might I also add:

Interval partitioning that works with a domain index (specifically spatial indexes)
and your idea: new type of interval partition, a "fill me with so much data and then mark the end of my range and create a new partition" would be really nice too!

Greg

David Aldridge, March 27, 2009 - 4:34 pm UTC

I'd like to be able to add a non-partitioned table as a new partition on an existing table, which is currently two steps (creating the new partition then partition exchanging).

Add interval partitioning to an already partitioned table

Eric Peterson, December 02, 2009 - 4:55 pm UTC

I have used DBMS_REDEFINITION to change a non-partitioned table to be partitioned. Do you have an example of where I can take an already range partitioned table (with list sub-partitions) to become interval range partitioned (by month) with the same list sub-partitions?

I made an example of creating a table with interval partition & sub-partitions. I noticed that when entering data before the first defined partition, that the data is placed in that first partition.

I like how if you enter data in the future, it does not create every possible partition between the old max date and the new entered date.

One feature I would like is the ability to give a naming template to the partition names (i.e. P_tablename_yyyy_mm). Maybe later. :)

Thanks much
Eric
Tom Kyte
December 04, 2009 - 9:51 am UTC

if you have list partitions and want to convert that into a range partitioned table (interval or not) you would be taking about "reorganizing" once again.

you don't give me an example of your list partitioning scheme, if it easily maps to a range partitioning scheme (eg: you list partition by part_a in ('A'), part_b in ('B'), part_C in ('C') versus part_1 in ('A',C'), part_2 in ('B')) show me and I'll show you the fastest way (via partition exchanges) to move it

but if your lists are not "sortable", if they interleave, you are rebuilding.

INTERVAL PARTITION

Eric Peterson, December 02, 2009 - 5:20 pm UTC



Ok, nevermind, I figured it out after being pointed in the right direction. :) This looks like the start of some wonderful programming...


DROP TABLE RPTMGR.test2 PURGE;

-- ---------- ---------- ----------
-- Create second test table 
-- WITHOUT interval partitioning
-- ---------- ---------- ----------
CREATE TABLE RPTMGR.test2
(  
  aa   DATE NOT NULL,
  bb   NUMBER NOT NULL
) 
PCTFREE 5 
PCTUSED 40 
NOCOMPRESS  
NOLOGGING 
PARALLEL 4
TABLESPACE rptmgr_tbl 
PARTITION BY RANGE ( aa ) 
SUBPARTITION BY LIST ( bb ) 
SUBPARTITION TEMPLATE ( 
    SUBPARTITION sp_odd     VALUES ( 1,3,5,7,9 )  TABLESPACE RPTMGR_TBL , 
    SUBPARTITION sp_even    VALUES ( 0,2,4,6,8 )  TABLESPACE RPTMGR_TBL , 
    SUBPARTITION sp_others  VALUES ( DEFAULT )    TABLESPACE RPTMGR_TBL  ) 
( PARTITION p_2008_10  VALUES LESS THAN ( TO_DATE( ' 2008-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN' ) ) 
PCTFREE 5 PCTUSED 40 TABLESPACE rptmgr_tbl NOCOMPRESS );



-- ---------- ---------- ----------
-- Attempt to put data in not in the above partition
-- ---------- ---------- ----------
INSERT INTO test2 VALUES ( TO_DATE ( '2009-10-01', 'YYYY-MM-DD' ), 1 );
--            *
-- ERROR at line 1:
-- ORA-14400: inserted partition key does not map to any partition


-- ---------- ---------- ----------
-- Insert data into the above partition
-- ---------- ---------- ----------
INSERT INTO test2 VALUES ( TO_DATE ( '2008-10-01', 'YYYY-MM-DD' ), 1 );
COMMIT;
EXEC DBMS_STATS.gather_table_stats( 'RPTMGR', 'TEST2', null, 100, false, 'FOR ALL COLUMNS', 4, 'ALL' );



-- ---------- ---------- ----------
— Where is it?
-- ---------- ---------- ----------
SET LONG 1000
COLUMN high_value         FORMAT A40 HEADING 'High Value' WORD_WRAPPED
COLUMN partition_name     FORMAT A9  HEADING 'Partition|Name'
COLUMN subpartition_name  FORMAT A19 HEADING 'Sub-Partition|Name'
COLUMN tablespace_name    FORMAT A10 HEADING 'Tablespace|Name'
COLUMN interval           FORMAT A8  HEADING 'Interval'
COLUMN num_rows           FORMAT 999 HEADING 'Row|Count'

SELECT 
  partition_name, 
  tablespace_name, 
  high_value, 
  interval,
  num_rows
FROM 
  user_tab_partitions
WHERE 
  table_name = 'TEST2';

-- Partition Tablespace                                                     Row
-- Name      Name       High Value                               Interval Count
-- --------- ---------- ---------------------------------------- -------- -----
-- P_2008_10 RPTMGR_TBL TO_DATE(' 2008-11-01 00:00:00',          NO           1
--                      'SYYYY-MM-DD HH24:MI:SS',
--                      'NLS_CALENDAR=GREGORIAN')



-- ---------- ---------- ----------
COLUMN high_value         FORMAT A12 HEADING 'High Value'

SELECT 
  partition_name, 
  subpartition_name, 
  high_value, 
  interval,
  TO_NUMBER ( DECODE ( num_rows, 0, NULL, num_rows ) ) AS num_rows
FROM 
  user_tab_subpartitions 
WHERE 
  table_name = 'TEST2';

-- Partition Sub-Partition                                                           Row
-- Name      Name                High Value                               Interval Count
-- --------- ------------------- ---------------------------------------- -------- -----
-- P_2008_10 P_2008_10_SP_ODD    1, 3, 5, 7, 9                            NO           1
-- P_2008_10 P_2008_10_SP_EVEN   0, 2, 4, 6, 8                            NO
-- P_2008_10 P_2008_10_SP_OTHERS DEFAULT                                  NO




-- ---------- ---------- ----------
-- Turn on INTERVAL PARTITIONING by month
-- ---------- ---------- ----------
ALTER TABLE test2 SET INTERVAL ( NUMTOYMINTERVAL ( 1, 'MONTH' ) );



-- ---------- ---------- ----------
-- Insert data far in the future
-- ---------- ---------- ----------
INSERT INTO test2 VALUES ( TO_DATE ( '2010-10-01', 'YYYY-MM-DD' ), 4 );
COMMIT;
EXEC DBMS_STATS.gather_table_stats( 'RPTMGR', 'TEST2', null, 100, false, 'FOR ALL COLUMNS', 4, 'ALL' );



-- ---------- ---------- ----------
-- Where is our new data?
-- ---------- ---------- ----------
SELECT 
  partition_name, 
  tablespace_name, 
  high_value, 
  interval,
  num_rows
FROM 
  user_tab_partitions
WHERE 
  table_name = 'TEST2';

-- Partition Tablespace                                                     Row
-- Name      Name       High Value                               Interval Count
-- --------- ---------- ---------------------------------------- -------- -----
-- P_2008_10 RPTMGR_TBL TO_DATE(' 2008-11-01 00:00:00',          NO           1
--                      'SYYYY-MM-DD HH24:MI:SS',
--                      'NLS_CALENDAR=GREGORIAN')
-- 
-- SYS_P44   RPTMGR_TBL TO_DATE(' 2010-11-01 00:00:00',          YES          1
--                      'SYYYY-MM-DD HH24:MI:SS',
--                      'NLS_CALENDAR=GREGORIAN')


-- ---------- ---------- ----------
SELECT 
  partition_name, 
  subpartition_name, 
  high_value, 
  interval,
  TO_NUMBER ( DECODE ( num_rows, 0, NULL, num_rows ) ) AS num_rows
FROM 
  user_tab_subpartitions 
WHERE 
  table_name = 'TEST2';

-- Partition Sub-Partition                                                           Row
-- Name      Name                High Value                               Interval Count
-- --------- ------------------- ---------------------------------------- -------- -----
-- P_2008_10 P_ODD              1, 3, 5, 7, 9                            NO           1
-- P_2008_10 P_EVEN             0, 2, 4, 6, 8                            NO
-- P_2008_10 P_OTHERS DEFAULT                                            NO
-- SYS_P44   SYS_SUBP41          1, 3, 5, 7, 9                            NO
-- SYS_P44   SYS_SUBP42          0, 2, 4, 6, 8                            NO           1
-- SYS_P44   SYS_SUBP43          DEFAULT                                  NO



DROP TABLE RPTMGR.test2 PURGE;


user defined naming

A reader, July 25, 2011 - 8:32 am UTC

Hi Tom,

But I have question on interval partitioning , When the partition is created it will create the name as 'SYS_XXX"
but how do we make sure it followed the user defined naming convention

CREATE TABLE company-sales
(
SALES_ID NUMBER,
SALES_DT DATE
)
PARTITION BY RANGE (SALES_DT)
(
PARTITION dec2009 VALUES LESS THAN (TO_DATE('2010-01-01','YYYY-MM-DD')),
PARTITION jan2010 VALUES LESS THAN (TO_DATE('2010-02-01','YYYY-MM-DD')),
PARTITION feb2010 VALUES LESS THAN (TO_DATE('2010-03-01','YYYY-MM-DD')),
PARTITION mar2010 VALUES LESS THAN (TO_DATE('2010-04-01','YYYY-MM-DD'))
)
);

when I add the new partion can we control the naming convention here

Thanks forthe help
Tom Kyte
July 27, 2011 - 8:06 pm UTC

you cannot control the name

you can rename them later, after they are created, but they will have a system generated name when they are created.

Partitioning function idea

Mike, July 28, 2011 - 5:19 am UTC

How about
CREATE TABLE MY_NONPARTITIONED_TABLE
EXCHANGEABLE WITH MY_PARTITIONED_TABLE;
which would pick up the columns in the correct order, the organization, indexes matching the local indexes, etc.
Tom Kyte
July 28, 2011 - 7:25 pm UTC

could be useful, yes...

Alex, October 02, 2018 - 9:20 pm UTC

Hi friends,

I have some random partitioning questions I'm having some trouble researching:

1. Do we need to make sure we add new partitions when using list or hash, or is that just necessary for range/interval?
2. Is there a methodology for understanding what number to use for hash partitioning?
3. Can you use the "update indexes" syntax for all the partitioning maintenance commands?
4. Can you use ILM/ADO together to drop partitions or archive with in-database archiving? I can't find the complete list of options for adding ILM policies.

Thank you.
Connor McDonald
October 03, 2018 - 4:04 am UTC

1. Do we need to make sure we add new partitions when using list or hash, or is that just necessary for range/interval?

In later releases, there is auto list partitioning (ie, like intervals for lists). In previous release, your job is to have a partition that will take the values you need (or the 'DEFAULT' keyword as a bucket)

2. Is there a methodology for understanding what number to use for hash partitioning?

Always a power of 2. After that, choose based on your concurrency and/or sizing needs.

3. Can you use the "update indexes" syntax for all the partitioning maintenance commands?

The vast majority yes. Varies from release to release.

4. Can you use ILM/ADO together to drop partitions or archive with in-database archiving? I can't find the complete list of options for adding ILM policies.

You need to provide an example of what you mean here

Alex, October 04, 2018 - 7:02 pm UTC

What I mean is, with ILM you can assign policies to partitions to compress or move storage tiers etc. I am wondering if there are options to drop the partition, or hide it using in-database archiving.

Connor McDonald
October 05, 2018 - 4:11 am UTC

I don't think the two are inter-related. To my knowledge, the only means of archiving a row (with in-database archiving) is to explicitly update the row.


Are storage indexes killing partitioning ?

Anonymous, October 08, 2018 - 9:48 am UTC

Hi

Is Oracle Autonomous Data Warehouse using partitioning ?

Storage indexes can accomplish many goals people are aiming at by using partitioning.

Will Oracle still have interest to develop partitioning ?

Chris Saxon
October 08, 2018 - 10:34 am UTC

Yes, we're still improving partitioning. There are several enhancements to it in 18c:

https://docs.oracle.com/en/database/oracle/oracle-database/18/vldbg/release-changes.html#GUID-4470CAFE-CFE4-4DB0-9A32-A6FF49F8368E

And yes, Autonomous Data Warehouse can use partitioning. You can specify this manually or let the system tune this for you:

https://docs.oracle.com/en/cloud/paas/autonomous-data-warehouse-cloud/user/experienced-database-users.html#GUID-4D0364B5-8CA1-4A38-83AE-05B1C9487465

Alex, October 10, 2018 - 6:46 pm UTC

Can you guys tell me if you can add ILM policies to a sub-partition? I surprisingly can't find anything on this.

Thank you.
Chris Saxon
October 11, 2018 - 3:01 pm UTC

Sure:

create table t (
  c1 int, c2 int
) partition by list ( c1 ) subpartition by hash ( c2 ) (
  partition p0 values ( 0 ) (
    subpartition p1 
      ilm add policy row store compress segment 
      after 2 years of creation, 
    subpartition p2
  )
) ;

select object_name, subobject_name, object_type
from   user_ilmobjects;

OBJECT_NAME   SUBOBJECT_NAME   OBJECT_TYPE          
T             P1               TABLE SUBPARTITION   


https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/CREATE-TABLE.html#GUID-F9CE0CC3-13AE-4744-A43C-EAC7A71AAAB6

More to Explore

VLDB

If you are new to partitioning, check out Connor McDonald's introduction series here.

VLDB

Documentation set on VLDB and Partitioning.