Doubts regarding partition table.
hi friends,
i'm using oracle 10g (10.2.0.1) on windows server 2003
i've a table, contains more than 2 million records, and it is range partition with quarterly by year.
like values less than('01-05-2008')
values less than('01-09-2008')
selecting multiple partition in single query without union is not possible.
so i fire the query like.
select col1,col2,col3 from table where r_date between ('01-01-2008','25-06-2008');
i would like to know that with this query, it will scan full table or it will scan only those two partitions...?
thanks,
i did that..
when i fire the following query...
select /*+ first_rows(1000) */ col1,col2,col3
from table
where r_date between to_date('01-01-2008','dd-mm-yyyy') and to_date('01-03-2008','dd-mm-yyyy');
explain plan:
SELECT STATEMENT, GOAL = HINT: FIRST_ROWS 11 1001 50050 640279 0 1 161
PARTITION RANGE ITERATOR 11 1001 50050 640279 1 1 161
TABLE ACCESS FULL DBO KEY_HISTORY_PART 11 1001 50050 640279 2 1 161
it shows table access full and partition range iterator..
because of that i'm asking..
thanks..
Similar Messages
-
Query regarding Partition table Explain plan
Hello,
We are amidst a tuning activity, wherein a large table has been partitioned for better administration. During testing, I was analyzing the explain plans for long running sql's and found a piece that I was unable to understand. The PSTART and PSTOP columns show ROWID as its value, which in normal partition pruning scenario be the Partition number or the KEY. I tried to look around for this issue but did not get enough information. Can anybody help me of what it means? Also, if there is a good explanation of the same, it will be extremely helpful.
The snippet from explain plan looks like:
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | Pstart| Pstop |
7 | TABLE ACCESS BY GLOBAL INDEX ROWID| XXXXXXXXXXXXXXXXXXXX | 43874 | 9083K| | 1386 (1)| 00:00:17 | ROWID | ROWID |
On another similar query it looks like:
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | Pstart| Pstop |
| 6 | TABLE ACCESS BY GLOBAL INDEX ROWID| XXXXXXXXXXXXXX | 22455 | 4648K| | 456 (1)| 00:00:06 | 9 | 9 |
I have another query with regards to the Partition tables. Does it, require/benefit if, the Indexes to be in partitioned mode? I tried to read about it but did not get a conclusive evidence. I am trying to test it and post here the outcome, but if anybody has experience of working with it, it would be great to have some advice.
Oracle Version:- 10.2.0.4
Regards,
Purvesh.Hi Purvesh.
Great explanation and example on this this topic...
Ask Tom "explain plan on range-partitioned table"
Hope this help. -
Regarding partition table..pls help
I am creating a table
as
CREATE TABLE T3
PARTITION BY RANGE(CREATED)
(PARTITION T1 VALUES LESS THAN (TO_DATE('01-APR-2006','DD-MON-YYYY')),
PARTITION T2 VALUES LESS THAN (TO_DATE('01-JUN-2006','DD-MON-YYYY')))
AS SELECT * FROM T1
am getting error :
ORA-14400: inserted partition key does not map to any partition
since am new to the partitioning concepts, pls help.
Thanks.Oups :-)
I referenced the source table name (T1) instead on the newly partitionned table (T3) fromyour original post, sory :)
The select should read:
SELECT *
FROM T3 PARTITION (T3);
Thinking of that, you should give another name to the partition in order to avoid confusion!
Yoann. -
Regarding Partition Table:Spilt Partition
Hi ,
I have create one partition table. I did range partitioned on this .original table has 1035 Millions records.
table has data from Jan 2008 to till May.I have create one partition of Jan-2008 to March 2009.
Name is PS_INTRIMDETAIL_TILL_MAR2009 .This Partition has one table space
Which has Five datafile of 20 GB.
Next Onwards Partitions are Apr2009,May2009 this partitons are Monthwise.
Now I want to split this PS_INTRIMDETAIL_TILL_MAR2009 partition on quaterly basis.
Kindly suggest me how can I split this partiton.
I also want to know the appropriate tablespace size for split partition.Hello,
Here;s how you can split your partition by quartely
ALTER TABLE TBLMEDRATINTRIM_DETAIL_ROAM_01
SPLIT PARTITION PS_INTROAM_TILL_MAR2009 AT
(TO_DATE(' 2009-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
INTO (PARTITION PS_INTROAM_TILL_Q4
TABLESPACE TABLESPACE TS_INTROAM_TILL_MAR2009
PARTITION PS_INTROAM_TILL_MAR2009);
ALTER TABLE KLONDIKE.TBLMEDRATINTRIM_DETAIL_ROAM_01
SPLIT PARTITION PS_INTROAM_TILL_Q4 AT
(TO_DATE(' 2008-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
INTO (PARTITION PS_INTROAM_TILL_Q3
PARTITION PS_INTROAM_TILL_Q4);
ALTER TABLE KLONDIKE.TBLMEDRATINTRIM_DETAIL_ROAM_01
SPLIT PARTITION PS_INTROAM_TILL_Q3 AT
(TO_DATE(' 2008-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
INTO (PARTITION PS_INTROAM_TILL_Q2
PARTITION PS_INTROAM_TILL_Q3);
ALTER TABLE TBLMEDRATINTRIM_DETAIL_ROAM_01
SPLIT PARTITION PS_INTROAM_TILL_Q2 AT
(TO_DATE(' 2008-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
INTO (PARTITION PS_INTROAM_TILL_Q1
PARTITION PS_INTROAM_TILL_Q2);To compress old partitions;
You can create one temp compressed for one quaretly partiton, you can repeat this process
1. create table Q1_cmp tablespace <ts_name> compress as select * from TBLMEDRATINTRIM_DETAIL_ROAM_01 where CALLEND between to_date('20080101,'YYYYMMDD') and to_date('20080331','YYYYMMDD');
2. Then exchange Q1 uncompressed partition with Q1_cmp
ALTER TABLE TBLMEDRATINTRIM_DETAIL_ROAM_01
EXCHANGE PARTITION PS_INTROAM_TILL_Q1
WITH TABLE Q1_CMP
EXCLUDING INDEXES
WITHOUT VALIDATION;
3. Then just rename partition back to original nameyou are in telecom and are you saving CDRs or MSUs, so tablespace size depends upon the volume. I suggest to go with the default value of 32 gig and I think it will grow upto 20 G
create tablespace q1_ts datafile '/location/q1_ts/q1_tsdat01.dbf' size 512M autoextend on next 256M maxsize unlimited.Hope this helps
Regards -
Problem regarding partitioning tables
hi all....good afternoon
I have a table of huge number of records and thats why I want to do partitioning of that table.
The column upon which I have to make the partition is of varchar2(7) type which contains the data in the format '2009APR', '2010JAN' etc etc..
Now I have to fetch out the first 4 characters of the datas (i.e only the year) and then I can partition the table based on the years.
How can I do that....plss help.
The database is in 10g..
create table test123
(name varchar2(10),
age number,
DOB varchar2(7),
gender varchar2(1)
);user12780416 wrote:
hi all....good afternoon
I have a table of huge number of records and thats why I want to do partitioning of that table.
The column upon which I have to make the partition is of varchar2(7) type which contains the data in the format '2009APR', '2010JAN' etc etc..
Now I have to fetch out the first 4 characters of the datas (i.e only the year) and then I can partition the table based on the years.
How can I do that....plss help.
The database is in 10g..
create table test123
(name varchar2(10),
age number,
DOB varchar2(7),
gender varchar2(1)
);I suggest you instead of this varchar column with date column like dat.And use this column as partition key.For example.
create table test123
(name varchar2(10),
age number,
DOB varchar2(7),
gender varchar2(1),
dat date
partition by range (dat)
partition part1 values LESS THAN (TO_DATE(' 2009-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')),
partition part2 values LESS THAN (TO_DATE(' 2009-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')),
partition part3 values LESS THAN (TO_DATE(' 2009-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')),
partition part4 values LESS THAN (TO_DATE(' 2009-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')),
partition part5 values LESS THAN (TO_DATE(' 2010-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
) -
Local index vs global index in partitioned tables
Hi,
I want to know the differences between a global and a local index.
I'm working with partitioned tables about 10 millons rows and 40 partitions.
I know that when your table is partitioned and your index non-partitioned is possible that
some database operations make your index unusable and you have tu rebuid it, for example
when yo truncate a partition your global index results unusable, is there any other operation
that make the global index unusable??
I think that the advantage of a global index is that takes less space than a local and is easier to rebuild,
and the advantage of a local index is that is more effective resolving a query isn't it???
Any advice and help about local vs global index in partitioned tables will be greatly apreciatted.
Thanks in advancehere is the documentation -> http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14220/partconc.htm#sthref2570
In general, you should use global indexes for OLTP applications and local indexes for data warehousing or DSS applications. Also, whenever possible, you should try to use local indexes because they are easier to manage. When deciding what kind of partitioned index to use, you should consider the following guidelines in order:
1. If the table partitioning column is a subset of the index keys, use a local index. If this is the case, you are finished. If this is not the case, continue to guideline 2.
2. If the index is unique, use a global index. If this is the case, you are finished. If this is not the case, continue to guideline 3.
3. If your priority is manageability, use a local index. If this is the case, you are finished. If this is not the case, continue to guideline 4.
4. If the application is an OLTP one and users need quick response times, use a global index. If the application is a DSS one and users are more interested in throughput, use a local index.
Kind regards,
Tonguç -
How can I add a new column in compress partition table.
I have a compress partition table when I add a new column in that table it give me an error "ORA-22856: CANNOT ADD COLUMNS TO OBJECT TABLES". I had cretaed a table in this clause. How can I add a new column in compress partition table.
CREATE TABLE Employee
Empno Number,
Tr_Date Date
COMPRESS PARTITION BY RANGE (Tr_Date)
PARTITION FIRST Values LESS THAN (To_Date('01-JUL-2006','DD-MON-YYYY')),
PARTITION JUNK Values LESS THAN (MAXVALUE));
Note :
When I create table with this clause it will allow me to add a column.
CREATE TABLE Employee
Empno Number,
Tr_Date Date
PARTITION BY RANGE (Tr_Date)
PARTITION FIRST Values LESS THAN (To_Date('01-JUL-2006','DD-MON-YYYY')),
PARTITION JUNK Values LESS THAN (MAXVALUE));
But for this I have to drop and recreate the table and I dont want this becaue my table is in online state i cannot take a risk. Please give me best solution.Hi Fahed,
I guess, you are using Oracle 9i Database Release 9.2.0.2 and the Table which you need to alter is in OLTP environment where data is usually inserted using regular inserts. As a result, these tables generally do not get much benefit from using table compression. Table compression works best on read-only tables that are loaded once but read many times. Tables used in data warehousing applications, for example, are great candidates for table compression.
Reference : http://www.oracle.com/technology/oramag/oracle/04-mar/o24tech_data.html
Topic : When to Use Table Compression
Bug
Reference : http://dba.ipbhost.com/lofiversion/index.php/t147.html
BUG:<2421054>
Affects: RDBMS (9-A0)
NB: FIXED
Abstract: ENH: Allow ALTER TABLE to ADD/DROP columns for tables using COMPRESS feature
Details:
This is an enhancement to allow "ALTER TABLE" to ADD/DROP
columns for tables using the COMPRESS feature.
In 9i errors are reported for ADD/DROP but the text may
be misleading:
eg:
ADD column fails with "ORA-22856: cannot add columns to object tables"
DROP column fails with "ORA-12996: cannot drop system-generated virtual column"
Note that a table which was previously marked as compress which has
now been altered to NOCOMPRESS also signals such errors as the
underlying table could still contain COMPRESS format datablocks.
As of 10i ADD/SET UNUSED is allowed provided the ADD has no default value.
Best Regards,
Muhammad Waseem Haroon
[email protected] -
Importing partitioned table data into non-partitioned table
Hi Friends,
SOURCE SERVER
OS:Linux
Database Version:10.2.0.2.0
i have exported one partition of my partitioned table like below..
expdp system/manager DIRECTORY=DIR4 DUMPFILE=mapping.dmp LOGFILE=mapping_exp.log TABLES=MAPPING.MAPPING:DATASET_NAPTARGET SERVER
OS:Linux
Database Version:10.2.0.4.0
Now when i am importing into another server i am getting below error
Import: Release 10.2.0.4.0 - 64bit Production on Tuesday, 17 January, 2012 11:22:32
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "MAPPING"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "MAPPING"."SYS_IMPORT_FULL_01": MAPPING/******** DIRECTORY=DIR3 DUMPFILE=mapping.dmp LOGFILE=mapping_imp.log TABLE_EXISTS_ACTION=APPEND
Processing object type TABLE_EXPORT/TABLE/TABLE
ORA-39083: Object type TABLE failed to create with error:
ORA-00959: tablespace 'MAPPING_ABC' does not exist
Failing sql is:
CREATE TABLE "MAPPING"."MAPPING" ("SAP_ID" NUMBER(38,0) NOT NULL ENABLE, "TG_ID" NUMBER(38,0) NOT NULL ENABLE, "TT_ID" NUMBER(38,0) NOT NULL ENABLE, "PARENT_CT_ID" NUMBER(38,0), "MAPPINGTIME" TIMESTAMP (6) WITH TIME ZONE NOT NULL ENABLE, "CLASS" NUMBER(38,0) NOT NULL ENABLE, "TYPE" NUMBER(38,0) NOT NULL ENABLE, "ID" NUMBER(38,0) NOT NULL ENABLE, "UREID"
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
ORA-39112: Dependent object type OBJECT_GRANT:"MAPPING" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type OBJECT_GRANT:"MAPPING" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type OBJECT_GRANT:"MAPPING" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type OBJECT_GRANT:"MAPPING" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type OBJECT_GRANT:"MAPPING" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type OBJECT_GRANT:"MAPPING" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type OBJECT_GRANT:"MAPPING" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
ORA-39112: Dependent object type INDEX:"MAPPING"."IDX_TG_ID" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type INDEX:"MAPPING"."PK_MAPPING" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type INDEX:"MAPPING"."IDX_UREID" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type INDEX:"MAPPING"."IDX_V2" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type INDEX:"MAPPING"."IDX_PARENT_CT" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
ORA-39112: Dependent object type CONSTRAINT:"MAPPING"."CKC_SMAPPING_MAPPING" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type CONSTRAINT:"MAPPING"."PK_MAPPING_ITM" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
ORA-39112: Dependent object type INDEX_STATISTICS skipped, base object type INDEX:"MAPPING"."IDX_TG_ID" creation failed
ORA-39112: Dependent object type INDEX_STATISTICS skipped, base object type INDEX:"MAPPING"."PK_MAPPING" creation failed
ORA-39112: Dependent object type INDEX_STATISTICS skipped, base object type INDEX:"MAPPING"."IDX_UREID" creation failed
ORA-39112: Dependent object type INDEX_STATISTICS skipped, base object type INDEX:"MAPPING"."IDX_V2" creation failed
ORA-39112: Dependent object type INDEX_STATISTICS skipped, base object type INDEX:"MAPPING"."IDX_PARENT_CT" creation failed
Processing object type TABLE_EXPORT/TABLE/COMMENT
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
ORA-39112: Dependent object type REF_CONSTRAINT:"MAPPING"."FK_MAPPING_MAPPING" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type REF_CONSTRAINT:"MAPPING"."FK_MAPPING_CT" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type REF_CONSTRAINT:"MAPPING"."FK_TG" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type REF_CONSTRAINT:"MAPPING"."FK_TT" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
Processing object type TABLE_EXPORT/TABLE/INDEX/FUNCTIONAL_AND_BITMAP/INDEX
ORA-39112: Dependent object type INDEX:"MAPPING"."X_PART" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type INDEX:"MAPPING"."X_TIME_T" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type INDEX:"MAPPING"."X_DAY" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
ORA-39112: Dependent object type INDEX:"MAPPING"."X_BTMP" skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/FUNCTIONAL_AND_BITMAP/INDEX_STATISTICS
ORA-39112: Dependent object type INDEX_STATISTICS skipped, base object type INDEX:"MAPPING"."IDX_TG_ID" creation failed
ORA-39112: Dependent object type INDEX_STATISTICS skipped, base object type INDEX:"MAPPING"."IDX_V2_T" creation failed
ORA-39112: Dependent object type INDEX_STATISTICS skipped, base object type INDEX:"MAPPING"."PK_MAPPING" creation failed
ORA-39112: Dependent object type INDEX_STATISTICS skipped, base object type INDEX:"MAPPING"."IDX_PARENT_CT" creation failed
ORA-39112: Dependent object type INDEX_STATISTICS skipped, base object type INDEX:"MAPPING"."IDX_UREID" creation failed
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
ORA-39112: Dependent object type TABLE_STATISTICS skipped, base object type TABLE:"MAPPING"."MAPPING" creation failed
Job "MAPPING"."SYS_IMPORT_FULL_01" completed with 52 error(s) at 11:22:39Please help..!!
Regards
Umesh Guptayes, i have tried that option as well.
but when i write one tablespace name in REMAP_TABLESPACE clause, it gives error for second one.. n if i include 1st and 2nd tablespace it will give error for 3rd one..
one option, what i know write all tablespace name in REMAP_TABLESPACE, but that too lengthy process..is there any other way possible????
Regards
UmeshAFAIK the option you have is what i recommend you ... through it is lengthy :-(
Wait for some EXPERT and GURU's review on this issue .........
Good luck ....
--neeraj -
FAT32 Partitions on GUID Partition Table External Drive Not Seen in Vista
I have an interesting predicament. I have repartitioned my external hard drive to have 5 partitions: 2 HFS+ and 3 FAT32. The external drive has a GUID Partition Table. The drive was formatted and partitioned using Disk Utility.
When I boot into Windows Vista using Boot Camp, Vista will ONLY mount the first Windows compatible partition. For example, if I have two partitions disk2s2 and disk2s3 (both FAT32), Vista only mounts disk2s2.
The described partition setup worked well with Master Boot Record, minus the bug with Time Machine choking every so often.
Any ideas on how I can get Vista to recognize these partitions?Hi Karl87,
according to the german computer magazine c't there is a limitation/flaw in the Master Boot Record (MBR:
Only the first four partitions are shown in the MBR and since one of these entrys is taken by the needed hidden EFI-partition and the next two entrys are taken by the OSX partition, there is only one of your three FAT partitions shown.
This limitation to four partition entries is quite old.
See here for further informations: http://en.wikipedia.org/wiki/Masterbootrecord
To my knowledge there is no solution for this.
Regards
Stefan -
Local Vs Global Index on partitioned table?
Hello All,
DESC PS_P1_EMP_QRYSCRTY
Name Null? Type
EMPLID NOT NULL VARCHAR2(11)
EMPL_RCD NOT NULL NUMBER(38)
ROWSECCLASS NOT NULL VARCHAR2(30)
ACCESS_CD CHAR(1)
MY SQL QUERY IS:-
SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY EMP
WHERE EMP.ROWSECCLASS=OPR.CLASSID
This query was taking around 15 mins to run at sql-prompt
I have created a partitioned table based on PS_P1_EMP_QRYSCRTY :-
CREATE TABLE PS_P1_EMP_QRYSCRTY_BAK
TABLESPACE PSNEWTAB
PARTITION BY HASH(ROWSECCLASS)
( PARTITION PART1 ,
PARTITION PART2 ,
PARTITION PART3 ,
PARTITION PART4 ,
PARTITION PART5 ,
PARTITION PART6 ,
PARTITION PART7 ,
PARTITION PART8 ,
PARTITION PART9 ,
PARTITION PART10 ,
PARTITION PART11 ,
PARTITION PART12 ,
PARTITION PART13 ,
PARTITION PART14 ,
PARTITION PART15 ,
PARTITION PART16
ENABLE ROW MOVEMENT
AS SELECT * FROM PS_P1_EMP_QRYSCRTY
I created a local index like on PS_P1_EMP_QRYSCRTY_BAK
CREATE INDEX PS_P1_EMP_QRYSCRTY_BAK
ON PS_P1_EMP_QRYSCRTY_BAK(ROWSECCLASS,EMPLID,EMPL_RCD)
TABLESPACE PSINDEX
LOCAL;
The Following is an extract From PS_P1_EMP_QRYSCRTY_BAK
1ST COLUMN =TABLE NAME
2ND COLUMN = PARTITION NAME
3RD COLUMN = NUM OF DISTINCT ROWSECCLASS IN THE PARTITION
4TH COLUMN = NUM OF TOTAL ROWS IN THE PARTITION
TABLE_NAME PARTITION_NAME NUM_OF_DISTINCT_ROWSECCLASS NUM_OF_ROWS
PS_P1_EMP_QRYSCRTY_BAK | PART1 | 25 | 289058
PS_P1_EMP_QRYSCRTY_BAK | PART2 | 25 | 154537
PS_P1_EMP_QRYSCRTY_BAK | PART3 | 27 | 364219
PS_P1_EMP_QRYSCRTY_BAK | PART4 | 33 | 204528
PS_P1_EMP_QRYSCRTY_BAK | PART5 | 23 | 527974
PS_P1_EMP_QRYSCRTY_BAK | PART6 | 22 | 277210
PS_P1_EMP_QRYSCRTY_BAK | PART7 | 23 | 517125
PS_P1_EMP_QRYSCRTY_BAK | PART8 | 30 | 307634
PS_P1_EMP_QRYSCRTY_BAK | PART9 | 28 | 523169
PS_P1_EMP_QRYSCRTY_BAK | PART10 | 38 | 192565
PS_P1_EMP_QRYSCRTY_BAK | PART11 | 27 | 120062
PS_P1_EMP_QRYSCRTY_BAK | PART12 | 33 | 407829
PS_P1_EMP_QRYSCRTY_BAK | PART13 | 37 | 522349
PS_P1_EMP_QRYSCRTY_BAK | PART14 | 25 | 275991
PS_P1_EMP_QRYSCRTY_BAK | PART15 | 21 | 259676
PS_P1_EMP_QRYSCRTY_BAK | PART16 | 23 | 468071
SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY_BAK EMP
WHERE EMP.ROWSECCLASS=OPR.CLASSID
Now when i run this query it gives result in around 5-6 mins
MY PS_P1_EMP_QRYSCRTY_BAK table contains sumwhat 6 million rows...
Now My Questions are:-
1) Is the number of partition done by me optimal under these circumstances...i mean can i get better performance By increasing or decreasing the number of partitions.
2) I created local index on PS_P1_EMP_QRYSCRTY_BAK.
Whether creating local or global index will be more beneficial keeping in mind the where clause and Select clause of the query....
SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY_BAK EMP
WHERE EMP.ROWSECCLASS=OPR.CLASSID
i mean in where clause rowsecclass is used thats why i partitioned my table on ROWSECCLASS.
And in select clause i m selecting EMPLID and EMPL_RCD
Thats y i made a local index on ROWSECCLASS,EMPLID ,EMPL_RCD .
Thanks
--Pradeep1) Is the number of partition done by me optimal under these circumstances...i mean can i get better performance >By increasing or decreasing the number of partitions.
2) I created local index on PS_P1_EMP_QRYSCRTY_BAK.
Whether creating local or global index will be more beneficial keeping in mind the where clause and Select clause of >the query....You'll have to see for yourself what is optimal. Every system is different. Here are some ideas, though.
Your query
SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY_BAK EMP
WHERE EMP.ROWSECCLASS=OPR.CLASSIDappears to read all qualifying rows across all qualifying partitions. Since you are partitioning by an id that would appear to exclude range and list partitioning instead so the hash partition is probably the best for your application.
Regarding global vs local partitions, I have seen timings indicate that global indexes can improve cross-partition queries slighly. I have not worked with partitions for a while but remember that global partition maintenance is difficult; anything the partition structure changes the global index had to be rebuild. You can check the documentation to see if that has changed.
If possible creating a unique index should give better performance than using an index allowing duplicates. -
How do I get my mac partition to use GUID partition Table Scheme?
I just bought the upgrade for Mountain Lion on my Macbook pro (Mac OS X 10.6.8). I went to install it and i had partitioned my internal harddrive with bootcamp to run windows 7. I went to select the Macintosh partition and it says that disk does not use the GUID partition Table scheme, and it will not let me select it for the upgrade. It says I have to use Disk Utility but I cant seem to figure out how to get it so I can upgrade it to mountain lion. Please help and thank you for your time
P.S. - Let me know if you need more information to get to the conclusion to this problem.Bonjour is built-in to OS X. No download is needed.
Safari has a Bonjour browser which you can activate by opening Safari Preferences, selecting Advanced and enabling one of the Bonjour entries to add a Bookmark. If you then select the Bookmark, all devices on your local network that are advertising themselves with Bonjour will be shown.
With regards to the Air not finding the printer attached via USB, you can open System Information and select USB in the left column. The top right pane will show all the USB busses on the Air and if the printer and its USB cable are working correctly, then the printer should be listed under one of the USB busses. Do you see it? If not, try another USB printer cable. -
Regarding Dimension Table and Fact table
Hello,
I am having basic doubts regarding the star schema.
Let me explain first regarding star schema.
Fact table containes Key fiigures and Dim IDs,Ok,
These DIm ids will be connected to my dimension tables.The Dimension table contains Characterstics and these Dim ids ,Ok.
Then My basic doubt
1.How does DIm id will be linked to SID tables
2.If I have not maintained any master data or text or Heirachies then SID tables will it be generated or not?
3.If it is generated I think there is use of This SID now..as we have not maintained Master data.
4.I am haing 18 characterstic which are no way related to each other in that scnerio how does Dimensions have to identified.?or we need to inclued whole chracterstics in one dimensions or we need to create seprate dimesnions for each of them..?(max is 13 dimensions)
5.If Dimension table contains dim ids and characterstics then where does the values for characterstics will be stored...?
( for ex..sales rep is characterstics for this we will be giving values some names where does these values will be stored..)hi Vasu,
e.g we have infocube with
- dimension 'location' -> characteristic 'sales rep', 'country'
- dimension 'partner'.
fact table
dim-id('sales person') dim-id('partner') revenue
1001 9001 500
1002 9002 300
1003 9004 200
dimenstion table 'location'
dim-id sid-id(sales rep) sid-id(country)
1001 3001 5001
1002 3004 5004
1003 3005 5001
'sales rep' sid table
sid sales rep
3001 abc
3004 pqr
3005 xyz
'country' sid table
5001 country1
5004 country2
so from the link dim-id and sid, we get
"sales rep report"
sales-rep revenue
abc 500
pqr 300
xyz 200
"country report"
country revenue
country1 700
country2 300
hope it's clear. -
Deadlock issue in Oracle 10g Partitioned Tables
Hi ALL,
I am facing an issue of Deadlock while inserting data into a partitioned table.
I get an error "ORA-00600: Deadlock detected". when i see the trace files, following lines are appearing in them:
"Single resource deadlock: blocking enqueue which blocks itself".
Here is the detail of my test case:
1. I have a list-partitioned table, with partitioning defined on some business codes.
2. I have a query that merges data into partitioned table (actually compares unique keys between temporary table and partitioned table and then issue an insert if keys not matched, no update part).
3. The temporary table contains transactional data against many business codes.
3. when calling the above query from multiple (PL/SQL) sessions, i observe that when we merge data in same partition (from different sessions) than deadlock issue occurs, otherwise it is OK.
4. Note that all sessions are executed at same time. Also note that Commit is called after each session is completed. Each session contains 2-3 more queries after the mentioned merge statement.
Is there an issue with oracle merge/insert on same partition (from different sessions)? What is the locking mechanism for this particular case (partitioned tables)?
My oracle version is Oracle 10g (10.2.0.4). Kindly advice.
Thanks,
QQ.Could you print the deadlock tree so we can see the type and mode of the locking. (Please use the 'code' tags - see FAQ at top right of screen - to showthe output in fixed font). can you list any SQL operated by this session that gets reported in the trace file.
Does the table reference itself in a foreign key.
Is this table involved in any referential integrity constraints.
Do you have a global primary key index, or a local primary key index ?
Are there any triggers on the table - if so do they contain autonomous transactions.
At present the only though that springs to mind is that the merge command has to lock the target table to do the insert/update, but it also has to lock any child table. The mode of the child lock depends on whether it has a suitable index or not, and whether the child table IS also the parent table. If you have two merges to the same partition one partition may get its locks, and the other partition may be in a state where it can't get one of the locks because it's wait for the other. (This shouldn't be a self-deadlock, though, but the scenario might be heading in the right direction for a self-deadlock).
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk
"The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge." (Stephen Hawking) -
Best way to insert data into a non indexed partitioned table?
Hi,
I've a rather basic question that I haven't been able to find an answer to so hope that someone may be able to help.
We need to insert sales data into a partitioned table that is range partitioned on sales date. The incoming sales data can span a number of days, e.g. 31-JUL-2007 through to 04-AUG-2007 inclusive. I've come up with two approaches and would like to know which you would recommend and why?
Approach 1: Load data into each individual partition using a statement like:
INSERT /*+ APPEND */ INTO sales PARTITION (sales_20070731) SELECT * FROM sales_new WHERE sales_date = TO_DATE('31-AUG-2007','DD-MON-YYYY')
Approach 2: Load data into the entire table using a statement like:
INSERT /*+ APPEND */ INTO sales SELECT * FROM sales_new
ThanksYou need to compare both approaches by creating simple test case.
But there is no advantages in approach 1until you will have index on sales_date column.
With index these approaches are comparable and you can choose whatever best fits to your requirements.
Best Regards,
Alex -
Oracle 11gR2 Partition tables not creating in default user tablespace
Hi all:
Not sure if i'm missing something or overlooked but when i create a partition table in a user schema, it is not creating in the schema's default tablespace instead creating with no assigned to any and using SYSTEM tablesspace.
create user dgp identified by dgp default tablespace dgp temporary tablespace temp;
grant connect, resource to dgp;select USERNAME,DEFAULT_TABLESPACE from dba_users where username ='DGP';
USERNAME DEFAULT_TABLESPACE
DGP DG
select table_name, tablespace_name, partitioned from all_tables where owner='DGP';
TABLE_NAME TABLESPACE_NAME PAR
AUDITLOG_P2 DG NO
AUDITLOG_P YES
This is the partition script i used --i also gave the tablespace name:
CREATE TABLE dgp.AUDITLOG_P(
entry_time DATE,
username VARCHAR2(14),
groupname VARCHAR2(100),
ip VARCHAR2(15),
command VARCHAR2(15),
directory VARCHAR2(300)
PARTITION BY RANGE (entry_time)
partition P_PAST VALUES LESS THAN (TO_DATE('2010-01-01','YYYY-MM-DD')),
tablespace DG;
============
What is it i'm missing? Anything different with Oracle 11gR2 on the partition creations?
Thanks for your help..
Regards,
AshYes, i tried using the schema login adn creating the table as well as system with schemaname prefix....
this is what i get from the below
SQL> select def_tablespace_name from dba_part_tables where table_name ='AUDITLOG_P';
DEF_TABLESPACE_NAME
DG
SQL> select partition_name, tablespace_name from dba_tab_partitions where table_name='AUDITLOG_P';
PARTITION_NAME TABLESPACE_NAME
P_PAST DG
P_20100101 DG
P_20100102 DG
P_20100103 DG
P_20100104 DG
P_20100105 DG
P_20100106 DG
P_20100107 DG
P_20100108 DG
P_20100109 DG
P_20100110 DG
P_20100111 DG
P_20100112 DG
P_20100113 DG
P_20100114 DG
P_20100115 DG
P_20100116 DG
P_20100117 DG
P_20100118 DG
P_20100119 DG
P_20100120 DG
P_20100121 DG
P_20100122 DG
P_20100123 DG
P_20100124 DG
P_20100125 DG
P_20100126 DG
P_20100127 DG
P_20100128 DG
P_20100129 DG
P_FUTURE DG
31 rows selected.
Maybe you are looking for
-
Do you know whether it's possible to customize a screen icon for the iPod MINI? I would like my own icon to show up either (a) just at startup, after the apple icon, and/or (b) as a screensaver. Any helpful suggestions would be greatly appreciated! S
-
GetURL problem in Internet Explorer 7 RC1
I'm doing the following in Internet Explorer 7 RC1: _root.getURL("foo.html", "_target"); However, it always loads in the current window, and not a new one. Has anyone else been experiencing this in the new IE release? I've checked my IE config settin
-
TS3899 my error is the user name or password for gmail is wrong
How do you change your gmail password?
-
I want to install cs5 extended on my new laptop
I deactivated cs5 from my old laptop and want to install it on my new laptop. I can't find my original install disks, where can I download the software?
-
Finder Size Mismatch with SMB Share
I have 2 SMB Servers (NSLU2 and DNS-323). In Finder all file sizes get rounded up to the nearest 1MB - for example a 2968 Byte file is listed as 1MB, a 1.1MB file is size is listed as 2MB etc. I have checked via Terminal, and all the files are listed