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

DB2 Conditional Delete Vs Load Replace


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

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Mon Sep 15, 2014 10:25 pm
Reply with quote

Hello,

I have a Weekly job, which unloads an entire table for backup followed by a IKJEFT01 step that deletes the records that are older than an year. The delete step consumes high CPU than the unload step (18 minutes vs 34 seconds). I was wondering if replacing the delete step with a DB2 LOAD REPLACE to load the last year's data will help.

The table currently contains about 3.8 Million records and about 30K records are deleted weekly. The date field that is used in the WHERE clause is not a part of any index in the table.

It would really help if someone can provide some pointers to guide me if LOAD REPLACE can help reducing the CPU time consumed by IKJEFT01 DELETE SQL.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2591
Location: NYC,USA

PostPosted: Mon Sep 15, 2014 11:38 pm
Reply with quote

Quote:
The date field that is used in the WHERE clause is not a part of any index in the table.


Why wouldn't this be a problem for spike in CPU?
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Tue Sep 16, 2014 12:02 am
Reply with quote

I am already working with the DBA's to add the time field to the Index being used in this query. I was just trying to see if there could be other parallel options that can help reduce the CPU further.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2591
Location: NYC,USA

PostPosted: Tue Sep 16, 2014 1:37 am
Reply with quote

Great!!
Time being I think you can unload the table completely , use a sort to remove data which (older than oneyear) and then use this file and run LOAD REPLACE. Check for the CPU stats and let us know.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Sep 16, 2014 1:49 am
Reply with quote

I've seen Rohit's method widely used in the shops I've worked at. Seems to be the quickest, especially with large tables. I suspect much of the CPU time is spent logging the deletes.
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Tue Sep 16, 2014 2:42 am
Reply with quote

Thanks Rohit and Terry. I'll keep you posted with updates.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Mon Sep 29, 2014 8:15 pm
Reply with quote

reorg discard when date < current_date - 1 year
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 How to replace a string dynamically i... CLIST & REXX 16
No new posts Need to split single line into two li... DFSORT/ICETOOL 7
No new posts Hex Value - vb file replace old date ... DFSORT/ICETOOL 14
No new posts Job is loading load modules several t... COBOL Programming 12
No new posts Need to delete inactive records from ... DB2 5
Search our Forums:

Back to Top