Unix Technical Forum

delete lock problem

This is a discussion on delete lock problem within the DB2 forums, part of the Database Server Software category; --> Hi, I have a scheduled job that does an archival job. Archive process deletes records by family i.e., say ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 08:57 AM
rajasdantony@gmail.com
 
Posts: n/a
Default delete lock problem

Hi,

I have a scheduled job that does an archival job. Archive process
deletes records by family i.e., say the application is based on travel
trips, "trip"s are archived one by one. When a "trip" is archived,
records related to that "trip" in various related tables are deleted in
proper hierarchy. Deletion itself takes long time (around 3 minutes per
"trip") on top of that it makes any other operation insert, update,
select to wait even though the data that's getting deleted is not at
all related to them.

I do deletes based on the primary key only ... some thing like

DELETE FROM TABLE1
WHERE TABLE1.PRIMARYKEYCOLUMN in (SELECT tempids FROM temptable)

Most of my selects have nolock. But still when this archival process
runs application is not usable by anyone else. Let me know if I'm
missing something. and if there is any solution, workaround to this
problem.

thanks for your help.

Regards,
Raja

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 08:58 AM
Shashi Mannepalli
 
Posts: n/a
Default Re: delete lock problem

Raja:

Do you have INDEXES on the column tempids on the table TEMPTABLE ?
If not ....create an index and try this again...

cheers...
Shashi Mannepalli

rajasdantony@gmail.com wrote:
> Hi,
>
> I have a scheduled job that does an archival job. Archive process
> deletes records by family i.e., say the application is based on travel
> trips, "trip"s are archived one by one. When a "trip" is archived,
> records related to that "trip" in various related tables are deleted in
> proper hierarchy. Deletion itself takes long time (around 3 minutes per
> "trip") on top of that it makes any other operation insert, update,
> select to wait even though the data that's getting deleted is not at
> all related to them.
>
> I do deletes based on the primary key only ... some thing like
>
> DELETE FROM TABLE1
> WHERE TABLE1.PRIMARYKEYCOLUMN in (SELECT tempids FROM temptable)
>
> Most of my selects have nolock. But still when this archival process
> runs application is not usable by anyone else. Let me know if I'm
> missing something. and if there is any solution, workaround to this
> problem.
>
> thanks for your help.
>
> Regards,
> Raja


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 08:58 AM
rajasdantony@gmail.com
 
Posts: n/a
Default Re: delete lock problem

Hi,

thanks for the reply. actually TEMPTABLE is a temporary table variable
with tempids as primary key. should I take car of anything else?

Thanks.
Raja

Shashi Mannepalli wrote:
> Raja:
>
> Do you have INDEXES on the column tempids on the table TEMPTABLE ?
> If not ....create an index and try this again...
>
> cheers...
> Shashi Mannepalli
>
> rajasdantony@gmail.com wrote:
> > Hi,
> >
> > I have a scheduled job that does an archival job. Archive process
> > deletes records by family i.e., say the application is based on travel
> > trips, "trip"s are archived one by one. When a "trip" is archived,
> > records related to that "trip" in various related tables are deleted in
> > proper hierarchy. Deletion itself takes long time (around 3 minutes per
> > "trip") on top of that it makes any other operation insert, update,
> > select to wait even though the data that's getting deleted is not at
> > all related to them.
> >
> > I do deletes based on the primary key only ... some thing like
> >
> > DELETE FROM TABLE1
> > WHERE TABLE1.PRIMARYKEYCOLUMN in (SELECT tempids FROM temptable)
> >
> > Most of my selects have nolock. But still when this archival process
> > runs application is not usable by anyone else. Let me know if I'm
> > missing something. and if there is any solution, workaround to this
> > problem.
> >
> > thanks for your help.
> >
> > Regards,
> > Raja


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:02 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com