Thanks Conor !
yeah we are doing some tests to workarout the timings with these inserts...
So, once data copy,index creations, backups, delta copy is done , we will rename the tables . T2(stage) table renamed to T1(application table).
Next moving on another bit - Table/Partitions/Indexes Statistics and SQL Plan stability
I have tried to explain the same as follows.
A) Current statistics:
=====================
Historically all the stats are locked and as we know current application table T1 has data in only 1st Partition PI_P01 completely filled and 2nd partition PI_P02 partially filled.
But all the partitions ( table/ index) stats have been set to the max and sealed. there is one exception to this - Index PI_PAD_FK_I is a forgein key column where no stats are set...
but the good part is that this index is not used by application at all and it is kept only for the sake oif avoiding locks when parent key column is updated etc.
Primarily priority is plan stability here. and that might be the reason for keepng the stats locked and fixed.
( old theory - big table/parition will be always big etc..)
All the indexes are LOCAL index.
SQL> select table_name, partition_name,object_type,num_rows, blocks,GLOBAL_STATS,LAST_ANALYZED, STATTYPE_LOCKED, stale_stats from dba_tab_statistics where
table_name in ('T1');
TABLE_NAME PARTITION_NAME OBJECT_TYPE NUM_ROWS BLOCKS GLOBAL_STATS LAST_ANAL STATTYPE_LOCKED STALE_STATS
------------------------------ ------------------------------ ------------ ---------------- ---------------- --------------- --------- -------------------- --------------------
T1 TABLE 3,222,108,620 12,305,272 YES 11/MAY/10 ALL YES
T1 PI_P01 PARTITION 1,032,041,760 3,833,381 YES 20/MAY/10 ALL YES
T1 PI_P02 PARTITION 1,032,041,760 3,833,381 YES 20/MAY/10 ALL YES
T1 PI_P03 PARTITION 1,032,041,760 3,833,381 YES 20/MAY/10 ALL NO
T1 PI_P04 PARTITION 1,032,041,760 3,833,381 YES 20/MAY/10 ALL NO
T1 PI_P05 PARTITION 1,032,041,760 3,833,381 YES 20/MAY/10 ALL NO
T1 PI_P06 PARTITION 1,032,041,760 3,833,381 YES 20/MAY/10 ALL NO
T1 PI_P07 PARTITION 1,032,041,760 3,833,381 YES 20/MAY/10 ALL NO
T1 PI_P08 PARTITION 1,032,041,760 3,833,381 YES 20/MAY/10 ALL NO
T1 PI_P09 PARTITION 1,032,041,760 3,833,381 YES 20/MAY/10 ALL NO
T1 PI_P10 PARTITION 1,032,041,760 3,833,381 YES 20/MAY/10 ALL NO
T1 PI_PMAXVALUE PARTITION 1,032,041,760 3,833,381 YES 20/MAY/10 ALL NO
12 rows selected.
SQL> select INDEX_NAME, PARTITION_NAME, object_type, blevel, LEAF_BLOCKS, DISTINCT_KEYS, CLUSTERING_FACTOR, num_rows,SAMPLE_SIZE, LAST_ANALYZED, GLOBAL_STATS,
2 USER_STATS, STATTYPE_LOCKED, STALE_STATS
3 from dba_ind_statistics where
4 table_name in ('T1')
5 order by index_name, PARTITION_NAME;
INDEX_NAME PARTITION_NAME OBJECT_TYPE BLEVEL LEAF_BLOCKS DISTINCT_KEYS CLUSTERING_FACTOR NUM_ROWS SAMPLE_SIZE LAST_ANAL GLOBAL_STATS USER_STATS STATTYPE_LOCKED STALE_STATS
--------------- --------------- ------------ ------ ----------- ------------- ----------------- ---------------- ----------- --------- --------------- --------------- -------------------- --------------------
PI_PAD_FK_I PI_P01 PARTITION YES YES ALL
PI_PAD_FK_I PI_P02 PARTITION YES YES ALL
PI_PAD_FK_I PI_P03 PARTITION YES YES ALL
PI_PAD_FK_I PI_P04 PARTITION YES YES ALL
PI_PAD_FK_I PI_P05 PARTITION YES YES ALL
PI_PAD_FK_I PI_P06 PARTITION YES YES ALL
PI_PAD_FK_I PI_P07 PARTITION YES YES ALL
PI_PAD_FK_I PI_P08 PARTITION YES YES ALL
PI_PAD_FK_I PI_P09 PARTITION YES YES ALL
PI_PAD_FK_I PI_P10 PARTITION YES YES ALL
PI_PAD_FK_I PI_PMAXVALUE PARTITION YES YES ALL
PI_PAD_FK_I INDEX 3 7448020 125 563441880 3,236,559,040 161827952 11/MAY/10 YES NO ALL YES
PI_PI_FK_I PI_P01 PARTITION 0 0 0 0 0 2500 20/MAY/10 YES YES ALL YES
PI_PI_FK_I PI_P02 PARTITION 0 0 0 0 0 2500 20/MAY/10 YES YES ALL YES
PI_PI_FK_I PI_P03 PARTITION 0 0 0 0 0 2500 20/MAY/10 YES YES ALL NO
PI_PI_FK_I PI_P04 PARTITION 0 0 0 0 0 2500 20/MAY/10 YES YES ALL NO
PI_PI_FK_I PI_P05 PARTITION 0 0 0 0 0 2500 20/MAY/10 YES YES ALL NO
PI_PI_FK_I PI_P06 PARTITION 0 0 0 0 0 2500 20/MAY/10 YES YES ALL NO
PI_PI_FK_I PI_P07 PARTITION 0 0 0 0 0 2500 20/MAY/10 YES YES ALL NO
PI_PI_FK_I PI_P08 PARTITION 0 0 0 0 0 2500 20/MAY/10 YES YES ALL NO
PI_PI_FK_I PI_P09 PARTITION 0 0 0 0 0 2500 20/MAY/10 YES YES ALL NO
PI_PI_FK_I PI_P10 PARTITION 0 0 0 0 0 2500 20/MAY/10 YES YES ALL NO
PI_PI_FK_I PI_PMAXVALUE PARTITION 0 0 0 0 0 2500 20/MAY/10 YES YES ALL NO
PI_PI_FK_I INDEX 0 0 0 0 0 0 11/MAY/10 YES NO ALL YES
PI_PK PI_P01 PARTITION 3 2573060 1032041760 518289160 1,032,240,640 51612032 20/MAY/10 YES YES ALL YES
PI_PK PI_P02 PARTITION 3 2573060 1032041760 518289160 1,032,240,640 39695313 20/MAY/10 YES YES ALL YES
PI_PK PI_P03 PARTITION 3 2573060 1032041760 518289160 1,032,240,640 31971072 20/MAY/10 YES YES ALL NO
PI_PK PI_P04 PARTITION 3 2573060 1032041760 518289160 1,032,240,640 2500 20/MAY/10 YES YES ALL NO
PI_PK PI_P05 PARTITION 3 2573060 1032041760 518289160 1,032,240,640 2500 20/MAY/10 YES YES ALL NO
PI_PK PI_P06 PARTITION 3 2573060 1032041760 518289160 1,032,240,640 2500 20/MAY/10 YES YES ALL NO
PI_PK PI_P07 PARTITION 3 2573060 1032041760 518289160 1,032,240,640 2500 20/MAY/10 YES YES ALL NO
PI_PK PI_P08 PARTITION 3 2573060 1032041760 518289160 1,032,240,640 2500 20/MAY/10 YES YES ALL NO
PI_PK PI_P09 PARTITION 3 2573060 1032041760 518289160 1,032,240,640 11301513 20/MAY/10 YES YES ALL NO
PI_PK PI_P10 PARTITION 3 2573060 1032041760 518289160 1,032,240,640 17630552 20/MAY/10 YES YES ALL NO
PI_PK PI_PMAXVALUE PARTITION 3 2573060 1032041760 518289160 1,032,240,640 8146607 20/MAY/10 YES YES ALL NO
PI_PK INDEX 3 8398280 393701412 1841488260 3,198,743,340 159937167 11/MAY/10 YES NO ALL YES
PI_UK PI_P01 PARTITION 3 3042620 1039253300 565922680 1,039,253,300 51962665 20/MAY/10 YES YES ALL YES
PI_UK PI_P02 PARTITION 3 3042620 1039253300 565922680 1,039,253,300 39993712 20/MAY/10 YES YES ALL YES
PI_UK PI_P03 PARTITION 3 3042620 1039253300 565922680 1,039,253,300 31346655 20/MAY/10 YES YES ALL NO
PI_UK PI_P04 PARTITION 3 3042620 1039253300 565922680 1,039,253,300 2500 20/MAY/10 YES YES ALL NO
PI_UK PI_P05 PARTITION 3 3042620 1039253300 565922680 1,039,253,300 2500 20/MAY/10 YES YES ALL NO
PI_UK PI_P06 PARTITION 3 3042620 1039253300 565922680 1,039,253,300 2500 20/MAY/10 YES YES ALL NO
PI_UK PI_P07 PARTITION 3 3042620 1039253300 565922680 1,039,253,300 2500 20/MAY/10 YES YES ALL NO
PI_UK PI_P08 PARTITION 3 3042620 1039253300 565922680 1,039,253,300 2500 20/MAY/10 YES YES ALL NO
PI_UK PI_P09 PARTITION 3 3042620 1039253300 565922680 1,039,253,300 11260216 20/MAY/10 YES YES ALL NO
PI_UK PI_P10 PARTITION 3 3042620 1039253300 565922680 1,039,253,300 17540534 20/MAY/10 YES YES ALL NO
PI_UK PI_PMAXVALUE PARTITION 3 3042620 1039253300 565922680 1,039,253,300 8564924 20/MAY/10 YES YES ALL NO
PI_UK INDEX 3 9995980 3234342560 1685810760 3,234,342,560 161717128 11/MAY/10 YES NO ALL YES
48 rows selected.
T1 table has 10 range partitioned (each 1,000,000,000 = 1b )
T2 table (new ) we have created 50 partitions and each ranged partitioned ( each 100,000,000 = 100m)
We have below 03 options when it comes to the stats management for the new table T2
a) copy / import stats from existing table/ index partitions to the new table/index partitions [we have more partitions in new table T2 so , stats are same in each of the
source T1 table paritions, so from either of the source partition stats can be copied to new partitions ] and lock these. As we have reduced the range of each partition in T2 (new) by 1/10, so in theory the existing stats 'should' work?
b) gather stats on each of the table/ index partitions and copy the same to remaining empty index and table partitions and lock these.
c) gather stats on each of the table/ index partitions at regular intervals (donot lock )
Your view on above please? most of the query retunrs small chunk (few tens) of rows from this table T1 table. No entire partition scan( pruning) is performed by the querries.
B) SQL Plan stability
=====================
We would like the SQL plan shouldnt get adversely affected here by this change . So we are capturing the SQL plan for the existing sqls and will enforce , just in case we see change in plan.
Your view on this please.
( and my apologies for the not been able to format the fixed -width data nicely,I used code tag but in preview one single line is split into two, i I think total width is the issue )