Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / June 2006

Tip: Looking for answers? Try searching our database.

COMMIT and DGTTs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jefftyzzer - 27 Jun 2006 01:39 GMT
Friends:

I've written a stored procedure that, among other things, writes
several million rows to a declared global temporary table (DGTT)
declared as NOT LOGGED using a (cursor) FOR loop. My rows-inserted
throughput starts out lightning-fast, but eventually plateaus to about
1 row per second. On what I thought was a lark, I decided to alter the
loop's cursor to WITH HOLD (the DGTT is, of course, declared to
preserve rows on COMMIT) and added a COMMIT to the INSERTing FOR loop
every 2000 records. Performance is now MUCH improved.

Questions:

1. If the query the cursor is based on is FOR READ ONLY WITH UR, and if
DGTT's, as private session objects, don't acquire locks and the one
I've declared is not logged, why did the COMMITing help so much? There
should be no locks to release nor accumulated log buffer entries to
flush.

2. Conventional wisdom says that COMMITs are expensive and are thus
recommended to be used sparingly, yet they made things better for my
processing, not worse. Why?

3. Does a COMMIT--in addition to releasing locks and causing log buffer
entries to be written--also force all dirty pages in the buffer pool to
be written to disk?

Details: IBM DB2 UDB 8.2.3 on AIX 5.2

Thank you for your considered replies.

--Jeff
Pierre Saint-Jacques - 27 Jun 2006 02:27 GMT
3) for your answer: Yes almost, not forced but: as the page is dirty, it can
be externalized like any other dirty page in the bp.  Since you do not
commit often, then DB2 has to rely on finding space for new pages coming in.
Without more info, I'd look at first the user temp space defined for the
DGTT.
Is its buffer poll shared with everything or not. If as you say there are
nillions of rows and you don't commit often, then it's possible you end up
with having to externalize uncommitted pages to the tempspace for the dgtt.
DB2 is trying to bring in the pages for the query and does not find clean
pages to replace.  It has to externalize dirty pages to make room.

A snapshot, with the buffer pool switch on, could tell you what is doing the
writing. Cleaners for threshold hit or dirty page steal cleans.
HTH,  Pierre.

Signature

Pierre Saint-Jacques
SES Consultants Inc.
514-737-4515

> Friends:
>
[quoted text clipped - 28 lines]
>
> --Jeff
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.