IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Cleaning a partitioned table in a data warehouse


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
revdpoel

New User


Joined: 01 Nov 2006
Posts: 56

PostPosted: Thu Dec 11, 2008 9:01 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Dec 12, 2008 11:34 am
Reply with quote

Hi,

May be by "loading" an empty file to the oldest partition..
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Dec 12, 2008 11:36 am
Reply with quote

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
View user's profile Send private message
revdpoel

New User


Joined: 01 Nov 2006
Posts: 56

PostPosted: Fri Dec 12, 2008 1:25 pm
Reply with quote

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
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Fri Dec 12, 2008 6:14 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
Search our Forums:

Back to Top