473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

SQL on Fire - Mass Deleting Data.

Linux Db2 LUW V8 FP 15

I was readiong Serge´s SQL on Fire presentation (part 2), and there is
a slide that shows how to mass delete data using procedures. Something
like:

loop: LOOP
DELETE FROM (SELECT 1 FROM Table WHERE InvDate <= dt FETCH FIRST
1000 ROWS ONLY) AS D;
IF SQLCODE = 100 THEN LEAVE loop;
END IF;
COMMIT;
END LOOP loop;

I have studied the access plan of the statement above, and compared it
to the plan of the statements my application runs (a simple 'delete
from table where ID=? and timestamp between ? and ?').

The plans are exactly the same, with the same Total Cost.

Question: Should I expect delete performance improvement if I use
procedures with Fetch First X rows, like Serge´s example ? How does
this compare to single DELETE statements, in terms of performance ?

Thanks in advance.

-Michel.

Oct 21 '07 #1
1 4964
Michel Esber wrote:
Linux Db2 LUW V8 FP 15

I was readiong Serge´s SQL on Fire presentation (part 2), and there is
a slide that shows how to mass delete data using procedures. Something
like:

loop: LOOP
DELETE FROM (SELECT 1 FROM Table WHERE InvDate <= dt FETCH FIRST
1000 ROWS ONLY) AS D;
IF SQLCODE = 100 THEN LEAVE loop;
END IF;
COMMIT;
END LOOP loop;

I have studied the access plan of the statement above, and compared it
to the plan of the statements my application runs (a simple 'delete
from table where ID=? and timestamp between ? and ?').

The plans are exactly the same, with the same Total Cost.

Question: Should I expect delete performance improvement if I use
procedures with Fetch First X rows, like Serge´s example ? How does
this compare to single DELETE statements, in terms of performance ?
Michel,

The purpose of this code is not to speed up delete.
The purpose it to achieve intermittent commits to limit log-space
consumption for a single transaction.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Oct 21 '07 #2

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

Similar topics

1
by: kartik | last post by:
Hi , I am in need to find a way, to mass copy the data from db2 table running in mainframe to universal database db2 on NT. I know that DB2 connect gives the flexiblity of connecting and...
3
by: Strasser | last post by:
In Access2000 mass emailing worked perfectly (very powerful tool!). Doesn't work when using XP version of both Access and Outlook, even though I checked the box to ensure that I was sending the...
5
by: Verde | last post by:
This is admittedly an apparently odd request... but please indulge me if you don't mind: Suppose I have two <asp:Button.../> on a page (Button1 and Button2). User clicks Button1 and triggers a...
6
by: Martin Bischoff | last post by:
Hi, I'm creating temporary directories in my web app (e.g. ~/data/temp/temp123) to allow users to upload files. When I later delete these directories (from the code behind), the application...
1
by: johnny | last post by:
hi all, I would like to understand which are the best ways to send bulk mailings like for newsletters and so on ( not spamming, always to receivers who opt-in ). I am not looking for code for...
2
by: Steven | last post by:
I have a service process that contains two services but only one of them ever works properly. The background is I have two classes which are Individual() and Mass() in the main service class and...
4
by: wrldruler | last post by:
Hello, First, I know it's against "Access Law" to save calculations in a table, but....I want/need to. I currently have sub-totals being calculated inside a form, using DMax, DCount, and...
1
by: lawrence k | last post by:
I'm pulling data out of an FLAC file. There is an embedded image. I'm using the great getId3 library (http://getid3.sourceforge.net ). Among the tags I'm pulling out is a mass of binary data,...
0
by: PokerMan | last post by:
Hi guys Can anyone tell me the best way to implement a mass email newshot, to 1million plus people! I have done this: 1) Set up a news email account on my server 2) Set that email as the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...

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.