View previous topic :: View next topic
|
Author |
Message |
revdpoel
New User
Joined: 01 Nov 2006 Posts: 56
|
|
|
|
We have a DB2-table in a datawarehouse. It contains history for 24 months. Every month contains between 10 and 12 million rows. Monthly the oldest month in the table is cleaned. So , november 2008 the data from november 2006 is cleaned, deleted.
The table is partitoned, but we are not allowed to use rotating partitions in prodcutions.
How do we clean the table?
First we unload the whole table and then we reload the table with all the data without the month that must be deleted. This takes a long time.
Does anyone have a better solution, for instance just enptying the oldest partition? How do I do that?
Thanks |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
May be by "loading" an empty file to the oldest partition.. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hello again,
You can consider REORG as well.
REORG utility reorganizes a table space or index to improve access performance and reclaim fragmented space. In addition, the utility can reorganize a single partition of either a partitioned index or a partitioned table space. You can specify the degree of access to your data during reorganization. If you specify REORG UNLOAD ONLY, the data is unloaded in a format that is acceptable to the LOAD utility of the same DB2 subsystem. |
|
Back to top |
|
|
revdpoel
New User
Joined: 01 Nov 2006 Posts: 56
|
|
|
|
Anuj,
The table is partitioned on month-key. When I load an empty file to the oldest partition, how do I get to know the partition number of the oldest partition? And we als wanno know how many rows have been deleted in that oldest partition. The data of the oldest partition can be thrown away, it doesn't have to be archived on another medium
Ron |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Hi,
Quote: |
The table is partitioned on month-key. |
First check it out. whether it is a table-partioned or index partitioned.
Quote: |
how do I get to know the partition number of the oldest partition? |
If its table partitioned, check the ddl of table.
If it is index partioned, check the ddl of the index for that table.
By this this method you will know the which partition is for which month, since you know for which month needs to be deleted. or otherwise you have to see it in the catalog table.
Quote: |
And we als wanno know how many rows have been deleted in that oldest partition. |
Just put a query with count(*) and in the where clause MONTH & YEAR. Before removing data from the partition.
Quote: |
The data of the oldest partition can be thrown away, it doesn't have to be archived on another medium |
Since the data is not required. You don't have to UNLOAD or take IC, but its good to have a back-up of the partition when deleting from production.
Since you know the partition number now from DDL of the table or index. You can just load that particular partition with an empty file.
Sushanth Bobby |
|
Back to top |
|
|
|