MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Delete Jobs

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
manojvoona
Beginner


Joined: 05 Jan 2006
Posts: 43
Topics: 14

PostPosted: Thu Nov 30, 2006 12:19 pm    Post subject: Delete Jobs Reply with quote

Hi,

This is regarding the delete jobs.
Our database host data of 45 days. so every day a job runs and deletes the datawhich ever is more than 45 days.

This job is takign more than 2 hours a day and we want to reduce the execution time.

what we thought of is to run the job once in a week. Here the data will be accumulated till 52 days and our job runs on the week end deleting all the data which ever is more than 45 days

Here our question if the job takes 2 hours daily
7 days => 2 * 7 = 14 hours.
Once in a week will it take 14 hour again or is it going to be a considerable saves here.

Thanks in advance. we appreciate all your help

Thanks
Manoj Voona
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Nov 30, 2006 9:21 pm    Post subject: Reply with quote

manojvoona,

You need to show the query you are using for delete. How are you deleting the rows? using an utility or a pgm with checkpoint restart feature?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
manojvoona
Beginner


Joined: 05 Jan 2006
Posts: 43
Topics: 14

PostPosted: Thu Nov 30, 2006 9:53 pm    Post subject: Reply with quote

Hi Kolusu,

Here is the query we are using

DELETE
FROM MUS.TUZ41 A
WHERE RCPT_DT < CURRENT DATE - 45 DAYS
AND NOT EXISTS
(SELECT 1
FROM MUS.TUZ02_MONTH_END B
WHERE B.MONTH_END_DT = A.RCPT_DT
)

This is done in the program with just above query.

thanks
Manoj Voona
Back to top
View user's profile Send private message Send e-mail
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Dec 01, 2006 6:50 am    Post subject: Reply with quote

If you have any kind of volume,
and I assume you have because of the time required to do the mass delete,
I suggest you delete over a cursor. The subselect for the EXISTS could be transfered to a COBOL Table - of 365 items - if necessary. And include periodic COMMITs in your cursor processing logic.

To have complete restart capability (so that you can report on the number of rows deleted) you would need a separate item (row in another table, row in same table with unique key, ...) that you would update with your statistics each time before a commit.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
manojvoona
Beginner


Joined: 05 Jan 2006
Posts: 43
Topics: 14

PostPosted: Sat Dec 02, 2006 6:15 pm    Post subject: Reply with quote

thanks a lot dbzTHEdinosauer,

Can you please elaborate and explain us. I am pretty new to DB2 Sad

Thanks in Advance
Manoj Voona
Back to top
View user's profile Send private message Send e-mail
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Sun Dec 03, 2006 11:41 am    Post subject: Reply with quote

The first WHERE phrase I understand. would you please explain the business logic behind the subselect:
Code:
 AND
   NOT EXISTS (SELECT 1
               FROM MUS.TUZ02_MONTH_END B
               WHERE B.MONTH_END_DT = A.RCPT_DT
              )

_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group