473,806 Members | 2,845 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Slow execution of Delete Statements

Linux RH 4.0 running DB2 V8 FP 11.

I have a table with ~ 11M rows and running DELETE statements is really
slow. Deleting 1k rows takes more than 3 minutes. If I run select
statements on the same table, I usually fetch rows in a reasonable
time.

The table has the following description:

MACHINE_ID VARCHAR (24)
COLLECT_TIME TIMESTAMP
PROCESS_NAME VARCHAR (64)
PROCESS_PID DECIMAL (10)

These fields are the table PK. There is also and index on (MACHINE_ID,
COLLECT_TIME).

I have run db2exfmt and the explain plan seems to indicate a low
statement cost. Statistics for table and indexes are updated.
I am puzzled by actual very slow execution speeds.

Can anyone guide me trace why and where are the execution constraints?

Thanks in advance,
Original Statement:
------------------
delete
from RTM.TBL_COLLECT _PSSTAT_WIN_RTM
where MACHINE_ID='000 423B0F8F61420F1 B8111A' and COLLECT_TIME between
'2006-04-17 00:00:55.0' and '2006-04-17 01:00:55.0'
Optimized Statement:
-------------------
DELETE
FROM RTM.TBL_COLLECT _PSSTAT_WIN_RTM AS Q1
WHERE $RID$ IN
(SELECT $RID$
FROM RTM.TBL_COLLECT _PSSTAT_WIN_RTM AS Q2
WHERE (Q2.COLLECT_TIM E <= '2006-04-17-01.00.55.000000 ') AND
('2006-04-17-00.00.55.000000 ' <= Q2.COLLECT_TIME ) AND
(Q2.MACHINE_ID = '000423B0F8F614 20F1B8111A'))

Access Plan:
-----------
Total Cost: 41.6416
Query Degree: 1

Rows
RETURN
( 1)
Cost
I/O
|
3.50129
DELETE
( 2)
41.6416
6.50129
/----+---\
3.50129 1.33235e+07
IXSCAN TABLE: RTM
( 3) TBL_COLLECT_PSS T
19.2224
3
|
1.33235e+07
INDEX: RTM
IPSSTAT_NEW_WIN

Apr 18 '06
14 9656

NUM_IO_CLEANERS seems to be extremely high, I would set it to 6 since u have
6 physical disks

Bufferpool size of urs is 256M which is good enuf. I assume when the delete
is executed, that is the only
active process at this time. (Assuming there are no triggers on the table).
What is size of your record?
Ensure there are no triggers on the table.

I normally set the LOGBUFSZ to fit a single transaction eg: 1000 records is
the limit then LOGBUFSZ would be
1000 * 200 where 200 is the size of each record. so I will set it to 50 4K
pages. This does not explain the
performance u are seeing.

Execute reorg and then runstats on the table and redo the test.

mpstat is a command on the unix platform to see the CPU/IO stats on the
machine. Are u using UNIX/Windows?
I am not sure what is the parallel in windows?

-Sumanth

"Michel Esber" <mi****@us.auto matos.com> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.com.. .
1) No, the delete statement deletes a maximum of 2k.
2) NUM_IOCLEANERS = 50. I have no more than 6 physical disks.
3) This is a 4 CPU P4 3GHz server. Also, I have 16GB.
4) Yeah, I belive this is not a problem.
5) The bufferpool for this tablespace has 20000 16k Pages. How do I
check if this number should be higher than it is?
6) LOGBUFSZ = 2048
7) I am sorry. Is this a command line switch that I should use with
db2exfmt ?

Thanks a lot.

Apr 18 '06 #11
I raised NUM_IOCLEANERS to a high number because I had several messages
regarding Dirty Pages being held in the Log. I will reduce it now ...
Though, what impact could this high number bring to the system ?

Yes, there are no triggers on the table. Also, my record size is ~ 248.
So I guess LOGBUFSZ is high enough.

I am running Linux. I use sar and see no memory/cpu constraint. IOwait
times are around 15%, which is not different from all my other systems.

Thanks again,

Apr 18 '06 #12
"Michel Esber" <mi****@us.auto matos.com> wrote in message
news:11******** **************@ e56g2000cwe.goo glegroups.com.. .
Linux RH 4.0 running DB2 V8 FP 11.

I have a table with ~ 11M rows and running DELETE statements is really
slow. Deleting 1k rows takes more than 3 minutes. If I run select
statements on the same table, I usually fetch rows in a reasonable
time.

The table has the following description:

MACHINE_ID VARCHAR (24)
COLLECT_TIME TIMESTAMP
PROCESS_NAME VARCHAR (64)
PROCESS_PID DECIMAL (10)

These fields are the table PK. There is also and index on (MACHINE_ID,
COLLECT_TIME).


If your PK is the 4 columns in the order you stated above, and you have an
additional index on (MACHINE_ID, COLLECT_TIME). in that order, then this
index is redundant and you should drop it. Dropping the index will speed up
deletes.

LOGBUFSZ of 512 is usually the max you should use. When it gets higher than
that, performance typically goes down slightly. Make sure your LOGFILSZ is
at least 10,000 and perhaps larger.

To flush your buffer pool more often to disk, set CHNGPS_THRESH to 20. As
mentioned by others, set NUM_IOCLEANERS to something smaller, maybe 4-6.
Apr 19 '06 #13
When you are running the delete, take a snapshot at the db level with
bufferpool switches on.
You are looking for how you data is externalized out of the buffer pool.
Num_iocleaners are the processes launched to clean the buffer pool. Theya
are triggered by:
1) chngpgs_thresh which is defaulted at 60% of any buffer pool is made up
of dirty (committed not externalized) pages.
2) log_gap_cleaner s. Triggered when softmax is hit. Externalize dirty pages
whose transactions are contained in the lo gap represented by softmax.
3) dirty page victim steals. Triggered by the fact that there are no pages
to be replaced in the buffer pool and the requesting transaction has to
externalize a page chosen by DB2 before it can bring its page for the
delete. Also known as a synchronous writes.

Your snapshot output will show you the total writes, and the total
asynchronous writes. 1) and 2) above are asynchronous and ok. /) is the
"baddy". You don't want to see any (or as few as possible).
If any show, then it is an indication of too small a buffer pool, as you say
you have high num_iocleaners.

Too high num_iocleaner is something our significant others understand very
well. "Too much cleaning is not good !!!"
This means a page may get cleaned, goes from dirty to clean, then gets
replaced by a request, and almost immediately, that replaced page is needed
for a row in it. Redo the I/O, bad performance.

There may be other issues for your long delete time but look into those to
give you an idea.
HTH, Pierre.

--
Pierre Saint-Jacques
SES Consultants Inc.
514-737-4515
"Michel Esber" <mi****@us.auto matos.com> a écrit dans le message de news:
11************* ********@u72g20 00...legro ups.com...
I raised NUM_IOCLEANERS to a high number because I had several messages
regarding Dirty Pages being held in the Log. I will reduce it now ...
Though, what impact could this high number bring to the system ?

Yes, there are no triggers on the table. Also, my record size is ~ 248.
So I guess LOGBUFSZ is high enough.

I am running Linux. I use sar and see no memory/cpu constraint. IOwait
times are around 15%, which is not different from all my other systems.

Thanks again,


Apr 19 '06 #14
Thank you all for your very helpful comments. They gave me great ideas
to troubleshoot my environment.

Thanks again.

Apr 19 '06 #15

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

Similar topics

0
1326
by: Jason Kirk | last post by:
I've just installed PHP 5 under Fedora Core 2 and I've been having speed problems with xsl and the dom functions. Previously I used the sablotron extension functions under PHP 4 with script execution times of under 5 seconds ( max of 0,2M xml files, with a fair number of xsl:key statements). Under PHP 5 execution times almost seem random and never seem to use the full system resources (memory-limit wasn't included as a compile option) --...
16
21360
by: mamo74 | last post by:
Hello. I am administering a SQL Server (Enterprise Edition on Windows 2003) from some month and can't understand what is going on in the latest week (when the db grow a lot). The DB is around 250G, and has one table with 1 billion rows. It is performing in a decent way, but can't understand why a particolar table has strong performance problem.
12
4036
by: Ian Murphy | last post by:
Hopefully someone else has seen something similar. We are experiencing an odd problem with aspnet, iis6 and w2k3. I have written a small site which works fine during the day. Each morning however the initial page load can take anything from 10 minutes to over an hour. Nothing seems to occur during this time. The first page load is simply incredibly slow. It seems to 'hang' until someone else tried to load the default.aspx, though there...
6
6714
by: MadMan2004 | last post by:
Hello all! I'm having a problem with a project I'm working on and I'd like to ask for anyone's input that might be helpful. I'm building a rather large front-end application connecting to an AS400 for the back end database and I'm experiencing slow response times when executing sql statements. Some select statement response times are bad. Not all, but some. And there doesn't seem to be a consistent factor in any of the sql statements...
2
8851
by: Cornelius Buschka | last post by:
Hi, we saw the following problem: We deleted all rows from a table B referencing table A (~500000 records). No problem, but the following try to delete all records from table A (~180000) lead to a "never ending" statement. We found out, that vacuuming table B after delete did the trick. It seems to us the database has to do scan thru deleted records on B while
14
1722
by: Ryan | last post by:
We've got as slightly unusual scenario happening whereby a statement is passed to SQL which consists of two parts. BEGIN TRANSACTION DELETE * FROM Whatever BULK INSERT INTO Whatever...(etc) COMMIT TRANSACTION The first is a deletion of the data and the second is the bulk insert of replacement data into that table. The error that we see is a
17
5108
by: romixnews | last post by:
Hi, I'm facing the problem of analyzing a memory allocation dynamic and object creation dynamics of a very big C++ application with a goal of optimizing its performance and eventually also identifying memory leaks. The application in question is the Mozilla Web Browser. I also have had similar tasks before in the compiler construction area. And it is easy to come up with many more examples, where such kind of statistics can be very...
46
13153
by: dunleav1 | last post by:
I have a process that does inserts that runs 50% slower that Oracle and Mssql. Queries normally take 50% slower than normal. DB2, Oracle, Mssql all are configured on same os, same disk array (raid 1/0 - 15k disks) but DB2 I/O seems to be significantly slower. Tablespaces are SMS with automatic prefetch set. My thought was to create the log buffer array as large as possible so I don't have to switch to disk much. I'm running circular...
6
3844
by: Raj | last post by:
We have a batch process that deletes about 7-8 million records every day & takes about 30-35 mins to complete. Is there a way to optimize deletes? Below is the statement delete from fact where (key,dt) in (select key,dt from dim1 union select key,dt from dim2) Fact table has composite index on key,someothecolumn,dt.
0
9719
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
10618
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
10366
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
10371
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
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
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...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3850
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.