Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Cleaning a partitioned table in a data warehouse

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Cleaning a partitioned table in a data warehouse
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

Senior Member


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

PostPosted: Fri Dec 12, 2008 11:34 am    Post subject:
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

Senior Member


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

PostPosted: Fri Dec 12, 2008 11:36 am    Post subject:
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    Post subject:
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: 1013
Location: India

PostPosted: Fri Dec 12, 2008 6:14 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us