473,766 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to improve the deletion rate.

Hi,
I have a requirement on improving the deletion rate on on records
of a table.
The table contains 5 million records, but since deleting everything
matching the condition at one go was giving the ROLLBACK segment
allocation error, the query was called in a loop and deleting 2000
rows at one interation.
My query is:
DELETE FROM Table1 WHERE TimeStamp >= TO_DATE('2003-11-30 18:30:00',
'YYYY-MM-DD HH24:MI:SS') and TimeStamp <= TO_DATE('2003-12-18
18:29:59', 'YYYY-MM-DD HH24:MI:SS') AND ROWNUM < 2000

The performance I am getting is deletion of 1.5 lakhs records
happening in 10 minutes. I am looking forward to 10 lakhs records in
10 minutes.

Thanks,
Tuhin
Jul 19 '05 #1
5 6591
tk****@ipolicyn et.com (Tuhin Kumar) wrote in message news:<e4******* *************** ****@posting.go ogle.com>...
Hi,
I have a requirement on improving the deletion rate on on records
of a table.
The table contains 5 million records, but since deleting everything
matching the condition at one go was giving the ROLLBACK segment
allocation error,
Then ask your DBA to increase rollback segment space. That's the right
answer.
the query was called in a loop and deleting 2000
rows at one interation.
My query is:
DELETE FROM Table1 WHERE TimeStamp >= TO_DATE('2003-11-30 18:30:00',
'YYYY-MM-DD HH24:MI:SS') and TimeStamp <= TO_DATE('2003-12-18
18:29:59', 'YYYY-MM-DD HH24:MI:SS') AND ROWNUM < 2000
Let me guess, NO INDEX on the Timestamp column. (so this does a full
table scan)

the DELETE itself is inside another loop that doesn't do a COMMIT
WORK; before executing the DELETE again.

(And I still wonder whether there are any foreign keys to this table,
resulting in cascading deletes.)

The performance I am getting is deletion of 1.5 lakhs records
happening in 10 minutes. I am looking forward to 10 lakhs records in
10 minutes.

Thanks,
Tuhin


I'm STILL curious: what is a "lakhs"?

ED
Jul 19 '05 #2
Hi Tuhin,

You should try to refine the where clause. You may use a BETWEEN clause
instead of two comparaison.

DELETE FROM Table1 WHERE TimeStamp BETWEEN TO_DATE('2003-11-30 18:30:00',
'YYYY-MM-DD HH24:MI:SS') and TO_DATE('2003-12-18 18:29:59', 'YYYY-MM-DD
H24:MI:SS') AND ROWNUM < 2000

Also it can be a good idea to create an index the field TimeStamp if it is
not already.

"Tuhin Kumar" <tk****@ipolicy net.com> wrote in message
news:e4******** *************** ***@posting.goo gle.com...
Hi,
I have a requirement on improving the deletion rate on on records
of a table.
The table contains 5 million records, but since deleting everything
matching the condition at one go was giving the ROLLBACK segment
allocation error, the query was called in a loop and deleting 2000
rows at one interation.
My query is:
DELETE FROM Table1 WHERE TimeStamp >= TO_DATE('2003-11-30 18:30:00',
'YYYY-MM-DD HH24:MI:SS') and TimeStamp <= TO_DATE('2003-12-18
18:29:59', 'YYYY-MM-DD HH24:MI:SS') AND ROWNUM < 2000

The performance I am getting is deletion of 1.5 lakhs records
happening in 10 minutes. I am looking forward to 10 lakhs records in
10 minutes.

Thanks,
Tuhin

Jul 19 '05 #3

"Ed prochak" <ed********@mag icinterface.com > wrote in message
news:4b******** *************** ***@posting.goo gle.com...
tk****@ipolicyn et.com (Tuhin Kumar) wrote in message

news:<e4******* *************** ****@posting.go ogle.com>...
Hi,
I have a requirement on improving the deletion rate on on records
of a table.
The table contains 5 million records, but since deleting everything
matching the condition at one go was giving the ROLLBACK segment
allocation error,


Then ask your DBA to increase rollback segment space. That's the right
answer.
the query was called in a loop and deleting 2000
rows at one interation.
My query is:
DELETE FROM Table1 WHERE TimeStamp >= TO_DATE('2003-11-30 18:30:00',
'YYYY-MM-DD HH24:MI:SS') and TimeStamp <= TO_DATE('2003-12-18
18:29:59', 'YYYY-MM-DD HH24:MI:SS') AND ROWNUM < 2000


Let me guess, NO INDEX on the Timestamp column. (so this does a full
table scan)

the DELETE itself is inside another loop that doesn't do a COMMIT
WORK; before executing the DELETE again.

(And I still wonder whether there are any foreign keys to this table,
resulting in cascading deletes.)

The performance I am getting is deletion of 1.5 lakhs records
happening in 10 minutes. I am looking forward to 10 lakhs records in
10 minutes.

Thanks,
Tuhin


I'm STILL curious: what is a "lakhs"?

ED


It is a local tem to India meaning a particular magnitude (like K for
thousands). I do not remember what particular order of magnitude it is.
Jim
Jul 19 '05 #4
Tuhin Kumar wrote:
Hi,
I have a requirement on improving the deletion rate on on records
of a table.
The table contains 5 million records, but since deleting everything
matching the condition at one go was giving the ROLLBACK segment
allocation error, the query was called in a loop and deleting 2000
rows at one interation.
My query is:
DELETE FROM Table1 WHERE TimeStamp >= TO_DATE('2003-11-30 18:30:00',
'YYYY-MM-DD HH24:MI:SS') and TimeStamp <= TO_DATE('2003-12-18
18:29:59', 'YYYY-MM-DD HH24:MI:SS') AND ROWNUM < 2000

The performance I am getting is deletion of 1.5 lakhs records
happening in 10 minutes. I am looking forward to 10 lakhs records in
10 minutes.

Thanks,
Tuhin


Have your dba create partitions, based on date.
Drop partion takes a fraction of what you are trying to accomplish.
Typical example of an application not designed for a lifetime.

If you don't get this, decrease your time stamp window, and run
until completion (e.g. delete 1 day at a time)
--
Merry Christmas and a Happy New Year,
Frank van Bortel

Jul 19 '05 #5
>
I'm STILL curious: what is a "lakhs"?

ED


Hi ED,

1 million = 10 lakh
"lakhs" is the local term used in India.

Regards,
Unmesh Deshpande
Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
1177
by: py | last post by:
Say I have... x = "132.00" but I'd like to display it to be "132" ...dropping the trailing zeros...I currently try this if x.endswith("0"): x = x if x.endswith("0"): x = x
9
3099
by: c676228 | last post by:
Hi, I am new to this discussion forum. I started to post questions on this forum since this Jan. and got many good responses and I am very appreciated to those who are willing to help with their expertise. That save me a lot of time and stress. I want to rate the post, but I only see questions "is this post helpful" and " why should I rate a post" link. I didn't see any thing "rate the post" link. I already sign into the community...
9
2331
by: Andy_Khosravi | last post by:
I'm an entry-level VBA programmer that is almost entirely self-taught. This means that while I have adequate knowledge of VBA in some areas, I have several gaps in others that may seem obvious to more experienced programmers. Please bear with me =) I'm having a problem that occurs intermittently (about 1 error per 1,000 transactions) with a routine I wrote. It would seem that the recordset command to .addnew is for whatever reason...
3
1681
by: A_Republican | last post by:
I am interested in writing my own secure file deletion program. I want to be able to read and write to my hard drive directly. My application will seach my hard drive for all locations marked for deletion and then replace it with "x" or something that securely removes previoius data. My question is what objects, API calls, etc, etc do I use to read and write directly to the hard drive? -- Regards, Shaun Goldston
12
2853
by: weeodett | last post by:
Is there a way to automate the deletion of the oldest rows in a transaction log file when the file reaches a certain number of rows? Currently, we are simply deleting the oldest rows manually every so often. But we would like to put something in place that will do this automatically. The reason for doing this is to ultimately improve the application's performance that writes the transactions to this file. When the file gets to be over about...
3
1694
by: dilippanda | last post by:
Hi All, I am experiencing performance issue while merging records from a select query. Also it is getting difficult to insert 100000 selected records into table which is taking around 30 mins. I have tested the select query which is taking around 40 sec to fetch 1Lakh records. Is there anyway to improve the insertion rate? Thanks,
4
7223
by: Dimitrios Apostolou | last post by:
Hello list, I want to limit the download speed when using urllib2. In particular, having several parallel downloads, I want to make sure that their total speed doesn't exceed a maximum value. I can't find a simple way to achieve this. After researching a can try some things but I'm stuck on the details: 1) Can I overload some method in _socket.py to achieve this, and perhaps
4
173
by: Tuhin Kumar | last post by:
Hi, I have a requirement on improving the deletion rate on on records of a table. The table contains 5 million records, but since deleting everything matching the condition at one go was giving the ROLLBACK segment allocation error, the query was called in a loop and deleting 2000 rows at one interation. My query is: DELETE FROM Table1 WHERE TimeStamp >= TO_DATE('2003-11-30 18:30:00', 'YYYY-MM-DD HH24:MI:SS') and TimeStamp <=...
6
4215
by: Bill H | last post by:
I am wondering if this is possible. I have a file that is accessed by multiple users and keeps track of activity (the file is polled by flash every 2 seconds). As users leave, the flash program tells the php program to remove them from the activity file, and as users access this activity file, users who have timed out (haven't been heard from in 60 seconds) are removed. Using a combination of flock, microsecond sleeps, loops and the flash...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10008
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.