Partition by hash or by range
To improve performance will we try to partition tables and use parallel query.
I guess that an equal distribution of the data spread over the partitions will be optimal to use parallel query.
What is the best partition key choice? Hash or range or ...
What is an efficient number of partitions? One per cpu? Or do you advise more?
A lot of factors are important when trying to determine how and by how much to partition. Is there a logical data element in the table to act as a range partition key e.g. order_date; if not then you would probably be better off with hash partitioning. Range partions are easier to administer, because when you need to work with a partition (take offline or backup etc), you can easily predict what parts of the data you are working with.
A lot also depends on what queries you are predicting to be run, if you expect a lot of queries based on the partition key, then this would provide a benefit.
If you are good a documenting what you are doing, then you may want to go with a mix of the two types, again depending on how the table is constructed and how the partition key would be used. Another depending factor would be the number of file systems you have available, and this is a much more important factor for parallel query then the actual number of partions.
If it was me, I would start with a small set of large tables, and experiment with what gives me the optimal performance in terms of type of partitioning, distribution of partitions and degree of parallelism.
And just to confuse the matter, as of 8i, it is now possible to partition by range and sub-partion by hash.
Similar Messages
-
Modify HUGE HASH partition table to RANGE partition and HASH subpartition
I have a table with 130,000,000 rows hash partitioned as below
----RANGE PARTITION--
CREATE TABLE TEST_PART(
C_NBR CHAR(12),
YRMO_NBR NUMBER(6),
LINE_ID CHAR(2))
PARTITION BY RANGE (YRMO_NBR)(
PARTITION TEST_PART_200009 VALUES LESS THAN(200009),
PARTITION TEST_PART_200010 VALUES LESS THAN(200010),
PARTITION TEST_PART_200011 VALUES LESS THAN(200011),
PARTITION TEST_PART_MAX VALUES LESS THAN(MAXVALUE)
CREATE INDEX TEST_PART_IX_001 ON TEST_PART(C_NBR, LINE_ID);
Data: -
INSERT INTO TEST_PART
VALUES ('2000',200001,'CM');
INSERT INTO TEST_PART
VALUES ('2000',200009,'CM');
INSERT INTO TEST_PART
VALUES ('2000',200010,'CM');
VALUES ('2006',NULL,'CM');
COMMIT;
Now, I need to keep this table from growing by deleting records that fall b/w a specific range of YRMO_NBR. I think it will be easy if I create a range partition on YRMO_NBR field and then create the current hash partition as a sub-partition.
How do I change the current partition of the table from HASH partition to RANGE partition and a sub-partition (HASH) without losing the data and existing indexes?
The table after restructuring should look like the one below
COMPOSIT PARTITION-- RANGE PARTITION & HASH SUBPARTITION --
CREATE TABLE TEST_PART(
C_NBR CHAR(12),
YRMO_NBR NUMBER(6),
LINE_ID CHAR(2))
PARTITION BY RANGE (YRMO_NBR)
SUBPARTITION BY HASH (C_NBR) (
PARTITION TEST_PART_200009 VALUES LESS THAN(200009) SUBPARTITIONS 2,
PARTITION TEST_PART_200010 VALUES LESS THAN(200010) SUBPARTITIONS 2,
PARTITION TEST_PART_200011 VALUES LESS THAN(200011) SUBPARTITIONS 2,
PARTITION TEST_PART_MAX VALUES LESS THAN(MAXVALUE) SUBPARTITIONS 2
CREATE INDEX TEST_PART_IX_001 ON TEST_PART(C_NBR,LINE_ID);
Pls advice
Thanks in advanceSorry for the confusion in the first part where I had given a RANGE PARTITION instead of HASH partition. Pls read as follows;
I have a table with 130,000,000 rows hash partitioned as below
----HASH PARTITION--
CREATE TABLE TEST_PART(
C_NBR CHAR(12),
YRMO_NBR NUMBER(6),
LINE_ID CHAR(2))
PARTITION BY HASH (C_NBR)
PARTITIONS 2
STORE IN (PCRD_MBR_MR_02, PCRD_MBR_MR_01);
CREATE INDEX TEST_PART_IX_001 ON TEST_PART(C_NBR,LINE_ID);
Data: -
INSERT INTO TEST_PART
VALUES ('2000',200001,'CM');
INSERT INTO TEST_PART
VALUES ('2000',200009,'CM');
INSERT INTO TEST_PART
VALUES ('2000',200010,'CM');
VALUES ('2006',NULL,'CM');
COMMIT;
Now, I need to keep this table from growing by deleting records that fall b/w a specific range of YRMO_NBR. I think it will be easy if I create a range partition on YRMO_NBR field and then create the current hash partition as a sub-partition.
How do I change the current partition of the table from hash partition to range partition and a sub-partition (hash) without losing the data and existing indexes?
The table after restructuring should look like the one below
COMPOSIT PARTITION-- RANGE PARTITION & HASH SUBPARTITION --
CREATE TABLE TEST_PART(
C_NBR CHAR(12),
YRMO_NBR NUMBER(6),
LINE_ID CHAR(2))
PARTITION BY RANGE (YRMO_NBR)
SUBPARTITION BY HASH (C_NBR) (
PARTITION TEST_PART_200009 VALUES LESS THAN(200009) SUBPARTITIONS 2,
PARTITION TEST_PART_200010 VALUES LESS THAN(200010) SUBPARTITIONS 2,
PARTITION TEST_PART_200011 VALUES LESS THAN(200011) SUBPARTITIONS 2,
PARTITION TEST_PART_MAX VALUES LESS THAN(MAXVALUE) SUBPARTITIONS 2
CREATE INDEX TEST_PART_IX_001 ON TEST_PART(C_NBR,LINE_ID);
Pls advice
Thanks in advance -
What is this Partition type mention in code "Partition by HASH".
Hi Team,
Regularly i am Adding new partions and sub-Partitions to production table, based on Date. For example Every Day Data stored in one partion.
please find below code, what i am using to add new partitions. I think this called RANGE partition.
CREATE TABLE "owner"."TABLE_NAME"
( "COLUMN01" VARCHAR2(4),
"ACOLUMN02" VARCHAR2(32) NOT NULL ENABLE,
BUFFER_POOL DEFAULT)
TABLESPACE "Tablespace_name"
PARTITION BY RANGE ("Daily_TIME")
(PARTITION "ABC_2008_08_31" VALUES LESS THAN (TO_DATE(' 2008-08-31 23:59:59', '
SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
Now i have found new type of code from one of the new table created by development team.
Code is.....
CREATE TABLE "owner"."TABLE_NAME"
( "COLUMN01" VARCHAR2(4),
"ACOLUMN02" VARCHAR2(32) NOT NULL ENABLE,
BUFFER_POOL DEFAULT)
TABLESPACE "Tablespace_name"
PARTITION BY HASH ("ACCOUNT_NUMBER")
(PARTITION "PART_P01"
TABLESPACE "tABLESPACE01",
PARTITION "pART_P13"
TABLESPACE "Tabelspace01") ENABLE ROW MOVEMENT;
There is no below code in new Table code....
( (PARTITION "ABC_2008_08_31" VALUES LESS THAN (TO_DATE(' 2008-08-31 23:59:59', '
SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
SO, i am unable to alter this table to add new partions monthly wise.
Please suggest me, How to save data date wise in this table. Also suggest me if it is not comes under RANGE Partion or not.
If not possible to add new partition data wise, I will inform to client.
Thanks & Regards,
VenkatNew table use hash partitioning, not range partitioning. You can refer to the Concepts:
http://docs.oracle.com/cd/E11882_01/server.112/e25789/schemaob.htm#CNCPT88864
The key of new partitioned table is account number, not date, therefore you cannot partition this table date-wise. -
Drop partitions in HASH partitioned table
SELECT * FROM product_component_version
NLSRTL 10.2.0.4.0 Production
Oracle Database 10g Enterprise Edition 10.2.0.4.0 64bi
PL/SQL 10.2.0.4.0 Production
TNS for Solaris: 10.2.0.4.0 ProductionI have a table which is partitioned by HASH into several partitions. I would like to remove them all the same way I can DROP partitions in a LIST or RANGE partitioned tables.
I COALESCE-d my table until it remained with only one partition. Now I've got a table with one HASH partition and I would like to remove it and to end up with unpartitioned table.
How could it be accomplished?
Thank you!Verdi wrote:
I have a table which is partitioned by HASH into several partitions. I would like to remove them all the same way I can DROP partitions in a LIST or RANGE partitioned tables.
I COALESCE-d my table until it remained with only one partition. Now I've got a table with one HASH partition and I would like to remove it and to end up with unpartitioned table.
How could it be accomplished?
You cannot turn a partitioned table into a non-partitioned table, but you could create a replacement table (including indexes etc.) and then use the 'exchange partition' option on the partitioned table. This will modify the data dictionary so the data segments for the partition exchange names with the data segments for the new table - which gives you a simple table, holding the data, in minimum time and with (virtually) no undo and redo.
The drawback to this method is that you have to sort out all the dependencies and privileges.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
Author: <b><em>Oracle Core</em></b> -
Update in table partition by hash
I have a table partitioned by hash. I want to make some updates (not on the partition key column and also not based on this column, i.e this column is not used in where clause).
Do I need to specify partition name in the query?
For a concrete example:
CREATE TABLE invoices
(invoice_id NUMBER NOT NULL,
customer_id NUMBER NOT NULL,
invoice_date DATE NOT NULL,
comments VARCHAR2(500))
PARTITION BY HASH (customer_id)
PARTITIONS 10
primary key is customer_id + invoice_date
I need to update invoice_id based on the rowid, like update invoices set invoice_id = MEMO_ID_1SQ.nextval where rowid = <variable>. I will be running this query from multiple processes and I want to make sure they are hitting different partitions, so they actually run in parallel.
Thanks in advance,
RaduRadu,
You can use parallel hint on your update statement.
update /*+ PARALLEL(invoices, 4) */ invoices set invoice_id = MEMO_ID_1SQ.nextval where rowid = <variable>;See following execution plan for both with and without using parallel option
SQL> update interfacerecords set status=1 where interfaceid=5;
200000 rows updated.
Elapsed: 00:00:03.75
Execution Plan
Plan hash value: 3154550297
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | 200K| 3125K| 128 (3)| 00:00:02 |
| 1 | UPDATE | INTERFACERECORDS | | | | |
|* 2 | TABLE ACCESS FULL| INTERFACERECORDS | 200K| 3125K| 128 (3)| 00:00:02 |
Predicate Information (identified by operation id):
2 - filter("INTERFACEID"=5)
Statistics
262 recursive calls
458353 db block gets
1539 consistent gets
378 physical reads
91750476 redo size
655 bytes sent via SQL*Net to client
585 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
200000 rows processed
SQL> commit;
Commit complete.
Elapsed: 00:00:00.00
SQL> set autotrace traceonly;
SQL> set timi on;
SQL> set lines 400;
SQL> update /*+ PARALLEL(interfacerecords, 4) */ interfacerecords set status=5 where status=1;
200000 rows updated.
Elapsed: 00:00:02.48
Execution Plan
Plan hash value: 2940696107
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | TQ |IN-OUT| PQ Distrib |
| 0 | UPDATE STATEMENT | | 1 | 13 | 35 (0)| 00:00:01 | | | |
| 1 | UPDATE | INTERFACERECORDS | | | | | | | |
| 2 | PX COORDINATOR | | | | | | | | |
| 3 | PX SEND QC (RANDOM)| :TQ10000 | 1 | 13 | 35 (0)| 00:00:01 | Q1,00 | P->S | QC (RAND) |
| 4 | PX BLOCK ITERATOR | | 1 | 13 | 35 (0)| 00:00:01 | Q1,00 | PCWC | |
|* 5 | TABLE ACCESS FULL| INTERFACERECORDS | 1 | 13 | 35 (0)| 00:00:01 | Q1,00 | PCWP | |
Predicate Information (identified by operation id):
5 - filter("STATUS"=1)
Statistics
309 recursive calls
214609 db block gets
30287 consistent gets
0 physical reads
63356488 redo size
654 bytes sent via SQL*Net to client
617 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
3 sorts (memory)
0 sorts (disk)
200000 rows processedRegards -
How many partitions will be created for range 1998-2000
hi experts,
i have created partition on a infocube with range as 1998 to 2000 im able to see 37 partitions only in DB02 transaction.
i read in saphelp document that 38 partitions will be created.
i.e <1998 and >2000
3 x 12 = 36 +2 = 38
but for me all records < 1998 are placed in partition 199801 and max value partition is created i.e >2000.
so please can anyone explain why this is happening.
Regards,
Venu Gopak.KHi Venu,
Found note 385163 - Partitioning on ORACLE since BW 2.0.
This has the following logic for creation of partitions. You can see that the first partition "/BIC/EPART_BSP200001" is created to take in the values of Jan 2000 and below (less than Feb 2000).
The table "/BIC/EPART_BSP" is created as follows:
CREATE TABLE "/BIC/EPART_BSP" ( ..... , SID_0CALMONTH , .... )
storage ( INIT , ...., ....... )
partition by range ( SID_0CALMONTH )
PARTITION "/BIC/EPART_BSP200001" VALUES LESS THAN (200002),
PARTITION "/BIC/EPART_BSP200002" VALUES LESS THAN (200003),
PARTITION "/BIC/EPART_BSP200211" VALUES LESS THAN (200212),
PARTITION "/BIC/EPART_BSP200212" VALUES LESS THAN (200213), PARTITION "/BIC/EPART_BSPMAXVALUE" VALUES LESS THAN (MAXVALUE)
Interesting...the help docu says there will be 2 additional partitions. The note suggests there will only be 1 additional partition. -
Is list partition and hash partition one and the same
I am creating table with partition with the commands
CREATE TABLE ABD (ENO NUMBER(5),CID NUMBER(3),ENAME VARCHAR2(10))
PARTITION BY LIST (ENO)
(PARTITION P1 VALUES (123),
PARTITION P2 VALUES (143),
PARTITION CLIENT_ID VALUES (746))
ALTER TABLE ABD
ADD PARTITION CLIENT_756 VALUES (756)
but when i describe the table script it is showing like this
CREATE TABLE ABD (
ENO NUMBER (5),
ENAME VARCHAR2 (10),
CID NUMBER (3) )
PARTITION BY HASH (ENO)
PARTITIONS 4
STORE IN ( USERS,USERS,USERS,
USERS);
actually i am creating list partition but it is showing hash partition why is it so?when i describe the table script it is showing like thisHow do you describe it, and which version are you on ?
TEST@db102 SQL> CREATE TABLE ABD (ENO NUMBER(5),CID NUMBER(3),ENAME VARCHAR2(10))
2 PARTITION BY LIST (ENO)
3 (PARTITION P1 VALUES (123),
4 PARTITION P2 VALUES (143),
5* PARTITION CLIENT_ID VALUES (746))
TEST@db102 SQL> /
Table created.
TEST@db102 SQL> ALTER TABLE ABD
2* ADD PARTITION CLIENT_756 VALUES (756)
TEST@db102 SQL> /
Table altered.
TEST@db102 SQL> select dbms_metadata.get_ddl('TABLE','ABD','TEST') from dual;
DBMS_METADATA.GET_DDL('TABLE','ABD','TEST')
CREATE TABLE "TEST"."ABD"
( "ENO" NUMBER(5,0),
"CID" NUMBER(3,0),
"ENAME" VARCHAR2(10)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(
BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
PARTITION BY LIST ("ENO")
(PARTITION "P1" VALUES (123)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" NOCOMPRESS ,
PARTITION "P2" VALUES (143)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" NOCOMPRESS ,
PARTITION "CLIENT_ID" VALUES (746)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" NOCOMPRESS ,
PARTITION "CLIENT_756" VALUES (756)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" NOCOMPRESS )
TEST@db102 SQL> -
What type of partition should I use? Range or Hash or ..?
Hi,
I am on Oracle 8.1.7.4 .
I have a table with 10 million rows and looks like its a good candidate for partitioning.
There is a varchar2 column and the data is evenly distributed on the string value. If I want to partition the table on that string value what type of partitioning can I use. How can I give the range, if I use range partition, on the string value ?
Can/Should I use hash partitioning?
I know that there is a list partitioning in O9i, but I am on 8i.
Please help.
Regards<quote>
I have a table with 10 million rows and looks like its a good candidate for partitioning.
</quote>
Table volume, in itself, is not enough to warrant partitioning ⦠hope you have some other reasons.
<quote>
⦠but would like to partition the table on the mentioned varchar2 column, so that queries would be efficiant.
</quote>
Since you donât mention the actual query or class of queries, maybe it is worth mentioning that partitioning could speed up some queries but also can slow down a lot more other queries.
<quote>
So, how can i re-create the table partitioned on a varchar2 column
</quote>
No different than numbers or dates?
create table tp
( str varchar2(10) not null
,fill char(20) not null
partition by range(str)
( partition p1 values less than ('F')
,partition p2 values less than ('L')
,partition p3 values less than ('R')
,partition p4 values less than (maxvalue)
insert into tp
select substr(object_name,1,10), lpad('x',20,'x')
from user_objects
flip@FLOP> select * from tp partition (p2);
STR FILL
F1 xxxxxxxxxxxxxxxxxxxx
GENERATE_R xxxxxxxxxxxxxxxxxxxx
IPSDEV.US. xxxxxxxxxxxxxxxxxxxxThe link to Tomâs article is fine ⦠it just happens to be one of the few threads heâs not mentioning that partitioning is not the magic fast=true mechanism ⦠look for some other articles on partitioning and youâll quickly discover his views on this subject.
There may be a case for partitioning ⦠but you havenât presented any reasonable justification for it ⦠so, why bother? -
Our os is;
SunOS 5.9
and database is;
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit
Our autotrace outputs are below also we have 10046 trace outputs;
08:41:04 tcell_dev@SCME > set timing on
08:41:19 tcell_dev@SCME > set autot on
08:41:21 tcell_dev@SCME > SELECT lnpessv.PROFILE_ID FROM SCME.LNK_PROFILEENTITY_SUBSSERVVAR lnpessv
08:41:25 2 WHERE lnpessv.SUBSCRIPTION_SERVICEVARIANT_ID = 1695083 ;
PROFILE_ID
1.400E+14
1.600E+14
Elapsed: 00:00:03.07
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=3 Bytes=51)
1 0 PARTITION HASH (ALL) (Cost=3 Card=3 Bytes=51)
2 1 INDEX (RANGE SCAN) OF 'PK_PROFILEENTITY_SUBSSERVVAR' (INDEX (UNIQUE)) (Cost=
3 Card=3 Bytes=51)
Statistics
1 recursive calls
0 db block gets
1539 consistent gets
514 physical reads
0 redo size
258 bytes sent via SQL*Net to client
273 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
2 rows processed
08:41:32 tcell_dev@SCME > SELECT lnpessv.PROFILE_ID FROM SCME.LNK_PROFILEENTITY_SUBSSERVVAR lnpessv
08:41:43 2 WHERE lnpessv.SUBSCRIPTION_SERVICEVARIANT_ID = 169508 ;
PROFILE_ID
1.400E+14
1.600E+14
Elapsed: 00:00:04.01
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=3 Bytes=51)
1 0 PARTITION HASH (ALL) (Cost=3 Card=3 Bytes=51)
2 1 INDEX (RANGE SCAN) OF 'PK_PROFILEENTITY_SUBSSERVVAR' (INDEX (UNIQUE)) (Cost=
3 Card=3 Bytes=51)
Statistics
1 recursive calls
0 db block gets
1537 consistent gets
512 physical reads
0 redo size
258 bytes sent via SQL*Net to client
273 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
2 rows processed
Here we see 97% wait time, and responce time is unexceptable; These are the waits from 10046 trace file;
WAIT #1: nam='gc cr grant 2-way' ela= 783 p1=341 p2=67065 p3=1 obj#=169530 tim=571610438395
WAIT #1: nam='db file sequential read' ela= 6924 file#=341 block#=67065 blocks=1 obj#=169530 tim=571610445466
WAIT #1: nam='gc cr grant 2-way' ela= 564 p1=294 p2=86263 p3=1 obj#=169531 tim=571610446493
WAIT #1: nam='db file sequential read' ela= 6629 file#=294 block#=86263 blocks=1 obj#=169531 tim=571610453158
INDEX RANGE SCAN PK_PROFILEENTITY_SUBSSERVVAR PARTITION: 1 512 (cr=1537 pr=512 pw=0 time=4272017 us)
This is the related tables properties;
OWNER SCME
TABLE_NAME LNK_PROFILEENTITY_SUBSSERVVAR
TABLESPACE_NAME DATA01
STATUS VALID
PCT_FREE 10
INI_TRANS 10
MAX_TRANS 255
INITIAL_EXTENT 65536
MIN_EXTENTS 1
MAX_EXTENTS 2147483645
LOGGING NO
BACKED_UP N
NUM_ROWS 239587420
BLOCKS 1587288
EMPTY_BLOCKS 0
AVG_SPACE 0
CHAIN_CNT 0
AVG_ROW_LEN 41
AVG_SPACE_FREELIST_BLOCKS 0
NUM_FREELIST_BLOCKS 0
DEGREE 1
INSTANCES 1
CACHE N
TABLE_LOCK ENABLED
SAMPLE_SIZE 71876226
LAST_ANALYZED 29.05.2006 23:21:24
PARTITIONED NO
TEMPORARY N
SECONDARY N
NESTED NO
BUFFER_POOL DEFAULT
ROW_MOVEMENT DISABLED
GLOBAL_STATS YES
USER_STATS NO
SKIP_CORRUPT DISABLED
MONITORING YES
DEPENDENCIES DISABLED
COMPRESSION DISABLED
DROPPED NO
We are suspecting rac configuration and hash partition and index usage with rac.
Any comments will be welcomed,
Thank you.
Tonguçthis is the output of dbms_metadata.get_ddl for the table;
CREATE TABLE "SCME"."LNK_PROFILEENTITY_SUBSSERVVAR"
( "SUBSCRIPTION_SERVICEVARIANT_ID" NUMBER NOT NULL ENABLE NOVALIDATE,
"PROFILE_ID" NUMBER NOT NULL ENABLE NOVALIDATE,
"CREATED_BY_ID" NUMBER,
"CREATED_DATE" DATE DEFAULT SYSDATE,
"UPDATED_BY_ID" NUMBER,
"UPDATED_DATE" DATE,
CONSTRAINT "PK_PROFILEENTITY_SUBSSERVVAR" PRIMARY KEY ("SUBSCRIPTION_SERVICEVARIANT_ID", "PROFILE_ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING
STORAGE(INITIAL 4194304
BUFFER_POOL DEFAULT)
TABLESPACE "INDX02" GLOBAL PARTITION BY HASH ("SUBSCRIPTION_SERVICEVARIANT_ID","PROFILE_ID")
(PARTITION "SYS_P52989"
TABLESPACE "INDX02",
PARTITION "SYS_P52990"
TABLESPACE "INDX02",
PARTITION "SYS_P54010"
TABLESPACE "INDX02",
PARTITION "SYS_P54011"
TABLESPACE "INDX02",
PARTITION "SYS_P54012"
TABLESPACE "INDX02") ;
CREATE UNIQUE INDEX "SCME"."PK_PROFILEENTITY_SUBSSERVVAR" ON "SCME"."LNK_PROFILEENTITY_SUBSSERVVAR" ("SUBSCRIPTION_SERVICEVARIANT_ID", "PROFILE_ID")
PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING
STORAGE(INITIAL 4194304
BUFFER_POOL DEFAULT)
TABLESPACE "INDX02" GLOBAL PARTITION BY HASH ("SUBSCRIPTION_SERVICEVARIANT_ID","PROFILE_ID")
(PARTITION "SYS_P52989"
TABLESPACE "INDX02",
PARTITION "SYS_P52990"
TABLESPACE "INDX02",
PARTITION "SYS_P53499"
TABLESPACE "INDX02",
PARTITION "SYS_P53500"
TABLESPACE "INDX02") ENABLE NOVALIDATE,
CONSTRAINT "FK_LNK_PROF_REFERENCE_SDP_SUBS" FOREIGN KEY ("SUBSCRIPTION_SERVICEVARIANT_ID")
REFERENCES "SCME"."SDP_SUBSCRIPTIONSERVICEVARIANT" ("SUBSCRIPTION_SERVICEVARIANT_ID") DEFERRABLE INITIALLY DEFERRED ENABLE NOVALIDATE
) PCTFREE 10 PCTUSED 40 INITRANS 10 MAXTRANS 255 NOCOMPRESS NOLOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "DATA01" ;
CREATE INDEX "SCME"."LNK_PROFILEENTITY_SUB_HNDX3" ON "SCME"."LNK_PROFILEENTITY_SUBSSERVVAR" ("SUBSCRIPTION_SERVICEVARIANT_ID")
PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING
STORAGE(INITIAL 2097152
BUFFER_POOL DEFAULT)
TABLESPACE "INDX02" GLOBAL PARTITION BY HASH ("SUBSCRIPTION_SERVICEVARIANT_ID")
(PARTITION "SYS_P53501"
TABLESPACE "INDX02",
PARTITION "SYS_P53502"
TABLESPACE "INDX02",
PARTITION "SYS_P53499"
TABLESPACE "INDX02",
PARTITION "SYS_P53500"
TABLESPACE "INDX02") ;
CREATE INDEX "SCME"."PROFILE_ID_NDX43" ON "SCME"."LNK_PROFILEENTITY_SUBSSERVVAR" ("PROFILE_ID")
PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "INDX03" ;
ALTER TABLE "SCME"."LNK_PROFILEENTITY_SUBSSERVVAR" ADD CONSTRAINT "PK_PROFILEENTITY_SUBSSERVVAR" PRIMARY KEY ("SUBSCRIPTION_SERVICEVARIANT_ID", "PROFILE_ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING
STORAGE(INITIAL 4194304
BUFFER_POOL DEFAULT)
TABLESPACE "INDX02" GLOBAL PARTITION BY HASH ("SUBSCRIPTION_SERVICEVARIANT_ID","PROFILE_ID")
(PARTITION "SYS_P52989"
TABLESPACE "INDX02",
PARTITION "SYS_P52990"
PARTITION "SYS_P53498"
TABLESPACE "INDX02",
PARTITION "SYS_P53499"
TABLESPACE "INDX02",
PARTITION "SYS_P53500"
TABLESPACE "INDX02") ENABLE NOVALIDATE;
ALTER TABLE "SCME"."LNK_PROFILEENTITY_SUBSSERVVAR" MODIFY ("SUBSCRIPTION_SERVICEVARIANT_ID" NOT NULL ENABLE NOVALIDATE);
ALTER TABLE "SCME"."LNK_PROFILEENTITY_SUBSSERVVAR" MODIFY ("PROFILE_ID" NOT NULL ENABLE NOVALIDATE); -
I have a table into which data is inserted daily and contain customer nos. Most of the queries contain where clauses with customer no. field and date field.
I am looking for some suggestions on the type table to be created (IOT or Normal) and also the partitioning options, hash/range on date/customer no or composite partitioning. Range partitioning on date is an obvious solution but the table may need maintantance in the future creating new partitions.You didn't specify Which oracle version and OS you are using. How can we know that what you are running and your table structure.
Also, your buffer busy waits are culprit and this might due to index range scan happening for every insert. But this is a guess -
Creation of Hash Partitioned Global Index
Hash Partion Index creation
Hi friends,
Could you suggest me whether we can create a hash partitioned index by using syntax as below in 9i.
CREATE INDEX hgidx ON tab (c1,c2,c3) GLOBAL
PARTITION BY HASH (c1,c2)
(PARTITION p1 TABLESPACE tbs_1,
PARTITION p2 TABLESPACE tbs_2,
PARTITION p3 TABLESPACE tbs_3,
PARTITION p4 TABLESPACE tbs_4);
I am getting error ORA-14005 Missing Key word Range.
Thanks in advance for your help.Yaseer,
Is it possible to create Non-Partitioned and Global Index on Range-Partitioned Table?
Yes
We have 4 indexes on CS_BILLING range-partitioned table, in which one is CBS_CLIENT_CODE(*local partitioned index*) and others are unknown types of index to me??
Means other 3 indexes are what type indexes ...either non-partitioned global index OR non-partitioned normal index??
You got local index and 3 non-partitioned "NORMAL" b-tree tyep indexes
Also if we create index as :(create index i_name on t_name(c_name)) By default it will create Global index. Please correct me......
Above staement will create non-partitioned index
Here is an example of creating global partitioned indexes
CREATE INDEX month_ix ON sales(sales_month)
GLOBAL PARTITION BY RANGE(sales_month)
(PARTITION pm1_ix VALUES LESS THAN (2)
PARTITION pm2_ix VALUES LESS THAN (3)
PARTITION pm3_ix VALUES LESS THAN (4)
PARTITION pm12_ix VALUES LESS THAN (MAXVALUE));Regards -
Uneven distribution in Hash Partitioning
Version :11.1.0.7.0 - 64bit Production
OS :RHEL 5.3
I have a range partitioning on ACCOUNTING_DATE column and have 24 monthly partitions.
To get rid of buffer busy waits on index, i have created global partitioned index using below ddl
DDL :
CREATE INDEX IDX_GL_BATCH_ID ON SL_JOURNAL_ENTRY_LINES(GL_BATCH_ID)
GLOBAL PARTITION BY HASH (GL_BATCH_ID) PARTITIONS 16 TABLESPACE OTC_IDX PARALLEL 8 INITRANS 8 MAXTRANS 8 PCTFREE 0 ONLINE;After index creation, i realized that only one index hash partition got all rows.
select partition_name,num_rows from dba_ind_partitions where index_name='IDX_GL_BATCH_ID';
PARTITION_NAME NUM_ROWS
SYS_P77 0
SYS_P79 0
SYS_P80 0
SYS_P81 0
SYS_P83 0
SYS_P84 0
SYS_P85 0
SYS_P87 0
SYS_P88 0
SYS_P89 0
SYS_P91 0
SYS_P92 0
SYS_P78 0
SYS_P82 0
SYS_P86 0
SYS_P90 256905355As far as i understand, HASH partitioning will distribute evenly. By looking at above distribution, i think, i did not benefit of having multiple insert points using HASH partitioning as well.
Here is index column statistics :
select TABLE_NAME,COLUMN_NAME,NUM_DISTINCT,NUM_NULLS,LAST_ANALYZED,SAMPLE_SIZE,HISTOGRAM,AVG_COL_LEN from dba_tab_col_statistics where table_name='SL_JOURNAL_ENTRY_LINES' and COLUMN_NAME='GL_BATCH_ID';
TABLE_NAME COLUMN_NAME NUM_DISTINCT NUM_NULLS LAST_ANALYZED SAMPLE_SIZE HISTOGRAM AVG_COL_LEN
SL_JOURNAL_ENTRY_LINES GL_BATCH_ID 1 0 2010/12/28 22:00:51 259218636 NONE 4It looks like that inserted data has always the same value for the partitioning key: it is expected that in this case the same partition is used because
>
For optimal data distribution, the following requirements should be satisfied:
Choose a column or combination of columns that is unique or almost unique.
Create multiple partitions and subpartitions for each partition that is a power of two. For example, 2, 4, 8, 16, 32, 64, 128, and so on.
>
See http://download.oracle.com/docs/cd/E11882_01/server.112/e16541/part_avail.htm#VLDBG1270.
Edited by: P. Forstmann on 29 déc. 2010 09:06 -
Design capture of hash partitioned tables
Hi,
Designer version 9.0.2.94.11
I am trying to capture from a server model where the tables are hash partitioned. But this errors because Designer only knows about range partitions. Does anyone know how I can get Designer to capture these tables and their constraints?
Thanks
PetePete,
I have tried all three "current" Designer clients 6i, 9i, and 10g, at the "current" revision of the repository (I can post details if interested). I have trawled the net for instances of this too, there are many.
As stated by Sue, the Designer product model does not support this functionality (details can be found on ORACLE Metalink under [Bug No. 1484454] if you have access), if not, see excerpt below. It appears that at the moment ORACLE have no urgent plans to change this (the excerpt is dated as raised in 2001 and last updated in May 2004).
Composite partitioning and List partitioning are equally affected.
>>>>> ORACLE excerpt details STARTS >>>>>
CDS-18014 Error: Table Partition 'P1' has a null String parameter
'valueLessThan' in file ..\cddo\cddotp.cpp function
cddotp_table_partition::cddotp_table_partition and line 122
*** 03/02/01 01:16 am ***
*** 06/19/01 03:49 am *** (CHG: Pri->2)
*** 06/19/01 03:49 am ***
Publishing bug, and upping priority - user is stuck hitting this issue.
*** 09/27/01 04:23 pm *** (CHG: FixBy->9.0.2?)
*** 10/03/01 08:30 am *** (CHG: FixBy->9.1)
*** 10/03/01 08:30 am ***
This should be considered seriously when looking at ERs we should be able to
do this
*** 05/01/02 04:37 pm ***
*** 05/02/02 11:44 am ***
I have reproduced this problem in 6.5.82.2.
*** 05/02/02 11:45 am *** ESCALATION -> WAITING
*** 05/20/02 07:38 am ***
*** 05/20/02 07:38 am *** ESCALATED
*** 05/28/02 11:24 pm *** (CHG: FixBy->9.0.3)
*** 05/30/02 06:23 am ***
Hash partitioning is not modelled in repository and to do so would require a
major model change. This is not feasible at the moment but I am leaving this
open as an enhancement request because it is a much requested facility.
Although we can't implement this I think we should try to detect 'partition by
hash', output a warning message that it is not supported and then ignore it.
At least then capture can continue. If this is possible, it should be tested
and the status re-set to '15'
*** 05/30/02 06:23 am *** (CHG: FixBy->9.1)
*** 06/06/02 02:16 am *** (CHG: Sta->15)
*** 06/06/02 02:16 am RESPONSE ***
It was not possible to ignore the HASH and continue processing without a
considerable amount of work so we have not made any changes. The existing
ERROR message highlights that the problem is with the partition. To enable
the capture to continue the HASH clause must be removed from the file.
*** 06/10/02 08:32 am *** ESCALATION -> CLOSED
*** 06/10/02 09:34 am RESPONSE ***
*** 06/12/02 06:17 pm RESPONSE ***
*** 08/14/02 06:07 am *** (CHG: FixBy->10)
*** 01/16/03 10:05 am *** (CHG: Asg->NEW OWNER)
*** 02/13/03 06:02 am RESPONSE ***
*** 05/04/04 05:58 am RESPONSE ***
*** 05/04/04 07:15 am *** (CHG: Sta->97)
*** 05/04/04 07:15 am RESPONSE ***
<<<<< ORACLE excerpt details ENDS <<<<<
I (like I'm sure many of us) have an urgent immediate need for this sort of functionality, and have therefore resolved to looking at some form of post process to produce the required output.
I imagine that it will be necessary to flag the Designer meta-data content and then manipulate the generator output once it's done its "raw" generation as a RANGE partition stuff (probably by using the VALUE_LESS_THAN field as its mandatory, and meaningless for HASH partitions!).
An alternative would be to write an API level generator for this using the same flag, probably using PL/SQL.
If you have (or anyone else has) any ideas on this, then I'd be happy to share them to see what we can cobble together in the absence of an ORACLE interface to their own product.
Peter -
Non-Partitioned Global Index on Range-Partitioned Table.
Hi All,
Is it possible to create Non-Partitioned Global Index on Range-Partitioned Table?
We have 4 indexes on CS_BILLING range-partitioned table, in which one is CBS_CLIENT_CODE(*local partitioned index*) and others are unknown types of index to me??
Means other 3 indexes are what type indexes ...either non-partitioned global index OR non-partitioned normal index??
Also if we create index as :(create index i_name on t_name(c_name)) By default it will create Global index. Please correct me......
Please help me in identifying other 3 indexes types by referring below ouputs!!!
select INDEX_NAME,TABLE_NAME,PARTITIONING_TYPE,LOCALITY from dba_part_indexes where TABLE_NAME='CS_BILLING';
INDEX_NAME TABLE_NAME PARTITI LOCALI
CSB_CLIENT_CODE CS_BILLING RANGE LOCAL
select index_name,index_type,table_name,table_type,PARTITIONED from dba_indexes where table_name='CS_BILLING';
INDEX_NAME INDEX_TYPE TABLE_NAME TABLE_TYPE PAR
CSB_CREATE_DATE NORMAL CS_BILLING TABLE NO
CSB_SUBMIT_ORDER NORMAL CS_BILLING TABLE NO
CSB_CLIENT_CODE NORMAL CS_BILLING TABLE YES
CSB_ORDER_NBR NORMAL CS_BILLING TABLE NO
select INDEX_OWNER,INDEX_NAME,TABLE_NAME,COLUMN_NAME from dba_ind_columns where TABLE_NAME='CS_BILLING';
INDEX_OWNER INDEX_NAME TABLE_NAME COLUMN_NAME
RPADMIN CSB_CREATE_DATE CS_BILLING CREATE_DATE
RPADMIN CSB_SUBMIT_ORDER CS_BILLING SUBMIT_TO_INVOICE
RPADMIN CSB_SUBMIT_ORDER CS_BILLING ORDER_NBR
RPADMIN CSB_CLIENT_CODE CS_BILLING CLIENT_CODE
RPADMIN CSB_ORDER_NBR CS_BILLING ORDER_NBR
select dip.index_name, dpi.locality, dip.partition_name, dip.status
from dba_part_indexes dpi, dba_ind_partitions dip
where dpi.table_name ='CS_BILLING'
and dpi.index_name = dip.index_name;
INDEX_NAME LOCALI PARTITION_NAME STATUS
CSB_CLIENT_CODE LOCAL CSB_2006_4Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2006_3Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2007_1Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2007_2Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2007_3Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2007_4Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2008_1Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2008_2Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2008_3Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2008_4Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2009_1Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2009_2Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2009_3Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2009_4Q USABLE
select * from dba_part_indexes
where table_name ='CS_BILLING'
and locality = 'GLOBAL';
no rows selected
-Yasser
Edited by: YasserRACDBA on Mar 5, 2009 11:45 PMYaseer,
Is it possible to create Non-Partitioned and Global Index on Range-Partitioned Table?
Yes
We have 4 indexes on CS_BILLING range-partitioned table, in which one is CBS_CLIENT_CODE(*local partitioned index*) and others are unknown types of index to me??
Means other 3 indexes are what type indexes ...either non-partitioned global index OR non-partitioned normal index??
You got local index and 3 non-partitioned "NORMAL" b-tree tyep indexes
Also if we create index as :(create index i_name on t_name(c_name)) By default it will create Global index. Please correct me......
Above staement will create non-partitioned index
Here is an example of creating global partitioned indexes
CREATE INDEX month_ix ON sales(sales_month)
GLOBAL PARTITION BY RANGE(sales_month)
(PARTITION pm1_ix VALUES LESS THAN (2)
PARTITION pm2_ix VALUES LESS THAN (3)
PARTITION pm3_ix VALUES LESS THAN (4)
PARTITION pm12_ix VALUES LESS THAN (MAXVALUE));Regards -
How to Implement 30 days Range Partitioning with Date column. Not Interval
Hi,
I am using the db:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit
Current table structure is:
CREATE TABLE A
a NUMBER,
CreationDate DATE
PARTITION BY RANGE (CreationDate)
INTERVAL ( NUMTODSINTERVAL (30, 'DAY') )
(PARTITION P_FIRST
VALUES LESS THAN (TIMESTAMP ' 2001-01-01 00:00:00'))
How can I define virtual column based partitioning with RANGE partitioning without using INTERVAL partitioning.
And that is with Intervals of 30 days.
For monthly I am trying as
CREATE TABLE A
a NUMBER,
CreationDate DATE,
monthly_interval date as (to_char(CreationDate,'MM-YYYY')) VIRTUAL
PARTITION BY RANGE (monthly_interval)
partition p_AUG12 values less than (to_date('08-2012','mm-yyyy')),
partition p_SEP12 values less than (to_date('09-2012','mm-yyyy')),
partition p_OCT12 values less than (to_date('10-2012','mm-yyyy'))
Enable ROw Movement
BUT CAN'T INSERT the data even for that:
Insert into a (a, CreationDate)
Values (1, '12-10-2012')
Insert into a (a, CreationDate)
Values (1, '12-10-2012')
Please suggest..Hi rp,
Interval Partitioned to Range. Created Daily Partitions from Monthly Part. got complicated so I am posting here.
Basically,
I know Interval Partitioning is a kind of Range partitioning. But explicitly for Interval Partitioned tables XML Indexes are not allowed as discussed here:
XMLIndexes on an Interval Partitioned Table??
I can do monthly partitions as :
CREATE TABLE A
a NUMBER,
CreationDate DATE,
monthly_interval varchar2(8) as (to_char(CreationDate,'MM-YYYY')) VIRTUAL
PARTITION BY RANGE (monthly_interval)
partition p_AUG12 values less than ('09-2012'),
partition p_SEP12 values less than ('10-2012'),
partition p_OCT12 values less than ('11-2012')
) Enable ROw Movement
Insert into a (a, CreationDate)
Values (1, '12-SEP-2012')
Insert into a (a, CreationDate)
Values (1, '14-SEP-2012')
Select * from A partition (p_SEP12)
Select * from A partition (p_AUG12)
Select * from A partition (p_OCT12)
Can we do it for 30 days partitions, instead of the monthly partitions. ANY suggestions..
Thanks..
Maybe you are looking for
-
Error while uploading data in LT03?
Dear All, I am uploading data in LT03 transaction and I am getting an error message 'System cannot find source storage bin'. I am using BAPI 'L_TO_CREATE_DN'. Even same error I am getting in recording. This is happened in the case of Partial delive
-
Apple TV stuck on commercials?
When streaming content via the ABC Television application, the stream stops at the end of a commercial break and repeats the video and audio from the last 1 second. Fast forwarding past this point allows the show to continue, but this is very disrupt
-
My iPhone 4s was stolen this weekend and I did the Remote Lock. What exactly does that do? Also, if i do the Remote Wipe will that erase all of my data and impede anyone from ever using the phone?
-
Where would I look to find my back ups from my iPad onto desk top computer? The tech. Who helped me try to repair my iPad helped me back them off the iPad onto desk top. Apple had to send new replacement iPad. Tech told me the back ups would be on
-
Restore catalog to new pc after unexpected event (loss or damage to old pc)
I know there is a recommended way to use PSE catalog backup to transfer a catalog to a new pc http://helpx.adobe.com/photoshop-elements/kb/backup-restore-move-catalog-photoshop.html This is fine for when I have planned to move to a new pc. But what a