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
 

 

DB2 Conditional Delete Vs Load Replace

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: DB2 Conditional Delete Vs Load Replace
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

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Mon Sep 15, 2014 11:38 pm    Post subject:
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    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Tue Sep 16, 2014 1:37 am    Post subject:
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: 1238
Location: Richfield, MN, USA

PostPosted: Tue Sep 16, 2014 1:49 am    Post subject:
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    Post subject:
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: 1278
Location: Belgium

PostPosted: Mon Sep 29, 2014 8:15 pm    Post subject:
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    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 JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm
No new posts Copybook structure in Load module Vai123 COBOL Programming 7 Fri Sep 16, 2016 8:29 pm


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