develooper Front page | perl.beginners | Postings from August 2009

Re: delete 20 000 records in oracle from perl

Thread Previous | Thread Next
From:
Raymond Wan
Date:
August 16, 2009 23:12
Subject:
Re: delete 20 000 records in oracle from perl
Message ID:
4A88F4CB.6090708@aist.go.jp

Hi Luke,


luke devon wrote:
> I wanted to delete some unwanted data in one of my oracle
> database.20 000 of records are there. This is actually on production .
> manually to delete  a record , it takes 2 mins of time. 
> 
> So now i decided to write a perl script to do this function
> by learning on the web.  Can somebody give me a exact guide to delete
> that amount of data , without giving any impact for performance of the
> database and i would like to ask what is the better way to do such a
> execution ?
> Do we have to implement more threads ?


Perhaps I'm misunderstanding the problem, but if you would like to remove 20,000 
records in an Oracle database, I don't believe that Perl will help you with 
that.  It seems that you're already doing everything in a single SQL statement; 
having Perl do it won't give you much added benefit   (i.e., no matter how you 
do it, you still have 20,000 records to delete).  If these records don't 
overlap, then you could consider a multi-threaded approach...I guess.

Another suggestion if this is a production server is to mark records as stale 
rather than deleting them (i.e., add a boolean flag as another column).  And 
then, when the server is least busy, delete the marked records.  Or, rather than 
a boolean flag, assign some number (say, from 0 to 9) and periodically delete a 
portion of the rows...sort of like how log files are handled [delete the oldest 
ones].

I presume your problem is that deleting 20,000 in one go is slowing down the 
Oracle server?

Ray





Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About