473,804 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Insert is slow are there tweaks?

Hello

I am running an insert that takes an awfully long time compared to the
same workload on Oracle.
It takes 44 minutes to insert 2.5 million records. It takes less time
to insert the records into the source table loading from disk.
The statement is below as is information about the table space.

So my questions are

1. does the lock affect the insert?
2. would a lock on the target table help?
3. would separate table spaces help/
4. do I have the right buffer size would a larger help?
5. what other parameters can I tweak?
6. is DB2 just slower than Oracle at inserts?

Thanks

Bob

The statements

LOCK TABLE KPI_VALUE_STAGE IN EXCLUSIVE MODE;

INSERT INTO kvsr_temp(YEAR_ NR, TIME_PERIOD_CD, PERIOD_NR, DAY_NR,
KPI_ID,
VALUE_TYPE_CD, KPI_VALUE, CURRENCY_CD,
VALID_AS_AT_DT, KPI_NM, SCORECARD_ID,
SCORECARD_NM,
KPI_CLASS_ID, DATA_SOURCE_ID, DATA_SOURCE_NM,
PARENT_SCORECAR D_ID, QUALIFIER_ID,
QUALIFIER_NM, STAGING_CREATED _DT)
SELECT YEAR_NR, ucase(TIME_PERI OD_CD), PERIOD_NR, DAY_NR, KPI_ID,
VALUE_TYPE_CD, KPI_VALUE, ucase(CURRENCY_ CD),
VALID_AS_AT_DT,
KPI_NM, SCORECARD_ID, SCORECARD_NM, KPI_CLASS_ID,
DATA_SOURCE_ID,
DATA_SOURCE_NM, PARENT_SCORECAR D_ID, QUALIFIER_ID,
QUALIFIER_NM, CREATED_DT
FROM KPI_VALUE_STAGE AS KVS;
Source table is created

NOT LOGGED INITIALLY
IN USERSPACE4K

and the destination table is created

NOT LOGGED INITIALLY
IN USERSPACE4K
it has no indexes but has an identity.

KVSR_TEMP_SID INT GENERATED ALWAYS AS IDENTITY(start with 1, increment
by 1, cache 20000, CYCLE)
NOT NULL,

The buffer pool

CREATE BUFFERPOOL "BP4K"
SIZE 1920
PAGESIZE 4 K
NOT EXTENDED STORAGE

The tablespace

CREATE REGULAR TABLESPACE USERSPACE4K
IN DATABASE PARTITION GROUP IBMDEFAULTGROUP
PAGESIZE 4 K
MANAGED BY SYSTEM
USING ('USERSPACE4K')
EXTENTSIZE 8
PREFETCHSIZE 8
BUFFERPOOL BP4K
DROPPED TABLE RECOVERY ON
Nov 12 '05 #1
4 4938
1. Yes.
2. Yes.
3. Depends on disk layout
4 . No. Yes (you asked 2 questions)
5. Make sure you have no Autocommit. Blocking.
6. No, it's faster.

"Bob Sparks" <Bo*******@exci te.com> wrote in message
news:9b******** *************** ***@posting.goo gle.com...
Hello

I am running an insert that takes an awfully long time compared to the
same workload on Oracle.
It takes 44 minutes to insert 2.5 million records. It takes less time
to insert the records into the source table loading from disk.
The statement is below as is information about the table space.

So my questions are

1. does the lock affect the insert?
2. would a lock on the target table help?
3. would separate table spaces help/
4. do I have the right buffer size would a larger help?
5. what other parameters can I tweak?
6. is DB2 just slower than Oracle at inserts?

Thanks

Bob

The statements

LOCK TABLE KPI_VALUE_STAGE IN EXCLUSIVE MODE;

INSERT INTO kvsr_temp(YEAR_ NR, TIME_PERIOD_CD, PERIOD_NR, DAY_NR,
KPI_ID,
VALUE_TYPE_CD, KPI_VALUE, CURRENCY_CD,
VALID_AS_AT_DT, KPI_NM, SCORECARD_ID,
SCORECARD_NM,
KPI_CLASS_ID, DATA_SOURCE_ID, DATA_SOURCE_NM,
PARENT_SCORECAR D_ID, QUALIFIER_ID,
QUALIFIER_NM, STAGING_CREATED _DT)
SELECT YEAR_NR, ucase(TIME_PERI OD_CD), PERIOD_NR, DAY_NR, KPI_ID,
VALUE_TYPE_CD, KPI_VALUE, ucase(CURRENCY_ CD),
VALID_AS_AT_DT,
KPI_NM, SCORECARD_ID, SCORECARD_NM, KPI_CLASS_ID,
DATA_SOURCE_ID,
DATA_SOURCE_NM, PARENT_SCORECAR D_ID, QUALIFIER_ID,
QUALIFIER_NM, CREATED_DT
FROM KPI_VALUE_STAGE AS KVS;
Source table is created

NOT LOGGED INITIALLY
IN USERSPACE4K

and the destination table is created

NOT LOGGED INITIALLY
IN USERSPACE4K
it has no indexes but has an identity.

KVSR_TEMP_SID INT GENERATED ALWAYS AS IDENTITY(start with 1, increment
by 1, cache 20000, CYCLE)
NOT NULL,

The buffer pool

CREATE BUFFERPOOL "BP4K"
SIZE 1920
PAGESIZE 4 K
NOT EXTENDED STORAGE

The tablespace

CREATE REGULAR TABLESPACE USERSPACE4K
IN DATABASE PARTITION GROUP IBMDEFAULTGROUP
PAGESIZE 4 K
MANAGED BY SYSTEM
USING ('USERSPACE4K')
EXTENTSIZE 8
PREFETCHSIZE 8
BUFFERPOOL BP4K
DROPPED TABLE RECOVERY ON

Nov 12 '05 #2
You have to activate not logged initially in the same unit of work,
else it will log. Are you doing that? Can also reduce number of FSCRs
searched and also look at append on if inserts are the priority.
Rgds, Phil
"Mark Yudkin" <my************ ***********@nos pam.org> wrote in message news:<cf******* ***@ngspool-d02.news.aol.co m>...
1. Yes.
2. Yes.
3. Depends on disk layout
4 . No. Yes (you asked 2 questions)
5. Make sure you have no Autocommit. Blocking.
6. No, it's faster.

"Bob Sparks" <Bo*******@exci te.com> wrote in message
news:9b******** *************** ***@posting.goo gle.com...
Hello

I am running an insert that takes an awfully long time compared to the
same workload on Oracle.
It takes 44 minutes to insert 2.5 million records. It takes less time
to insert the records into the source table loading from disk.
The statement is below as is information about the table space.

So my questions are

1. does the lock affect the insert?
2. would a lock on the target table help?
3. would separate table spaces help/
4. do I have the right buffer size would a larger help?
5. what other parameters can I tweak?
6. is DB2 just slower than Oracle at inserts?

Thanks

Bob

The statements

LOCK TABLE KPI_VALUE_STAGE IN EXCLUSIVE MODE;

INSERT INTO kvsr_temp(YEAR_ NR, TIME_PERIOD_CD, PERIOD_NR, DAY_NR,
KPI_ID,
VALUE_TYPE_CD, KPI_VALUE, CURRENCY_CD,
VALID_AS_AT_DT, KPI_NM, SCORECARD_ID,
SCORECARD_NM,
KPI_CLASS_ID, DATA_SOURCE_ID, DATA_SOURCE_NM,
PARENT_SCORECAR D_ID, QUALIFIER_ID,
QUALIFIER_NM, STAGING_CREATED _DT)
SELECT YEAR_NR, ucase(TIME_PERI OD_CD), PERIOD_NR, DAY_NR, KPI_ID,
VALUE_TYPE_CD, KPI_VALUE, ucase(CURRENCY_ CD),
VALID_AS_AT_DT,
KPI_NM, SCORECARD_ID, SCORECARD_NM, KPI_CLASS_ID,
DATA_SOURCE_ID,
DATA_SOURCE_NM, PARENT_SCORECAR D_ID, QUALIFIER_ID,
QUALIFIER_NM, CREATED_DT
FROM KPI_VALUE_STAGE AS KVS;
Source table is created

NOT LOGGED INITIALLY
IN USERSPACE4K

and the destination table is created

NOT LOGGED INITIALLY
IN USERSPACE4K
it has no indexes but has an identity.

KVSR_TEMP_SID INT GENERATED ALWAYS AS IDENTITY(start with 1, increment
by 1, cache 20000, CYCLE)
NOT NULL,

The buffer pool

CREATE BUFFERPOOL "BP4K"
SIZE 1920
PAGESIZE 4 K
NOT EXTENDED STORAGE

The tablespace

CREATE REGULAR TABLESPACE USERSPACE4K
IN DATABASE PARTITION GROUP IBMDEFAULTGROUP
PAGESIZE 4 K
MANAGED BY SYSTEM
USING ('USERSPACE4K')
EXTENTSIZE 8
PREFETCHSIZE 8
BUFFERPOOL BP4K
DROPPED TABLE RECOVERY ON

Nov 12 '05 #3
Just to be sure a unit of work is everything between begin transaction
and commit or rollback? Or is it everything on the connection until
log off? Is it true the "not logged" feature get turned off after a
commit?

Thanks

Bob

pg******@gunnin gts.com (Phil Gunning) wrote in message news:<34******* *************** ****@posting.go ogle.com>...
You have to activate not logged initially in the same unit of work,
else it will log. Are you doing that? Can also reduce number of FSCRs
searched and also look at append on if inserts are the priority.
Rgds, Phil
"Mark Yudkin" <my************ ***********@nos pam.org> wrote in message news:<cf******* ***@ngspool-d02.news.aol.co m>...
1. Yes.
2. Yes.
3. Depends on disk layout
4 . No. Yes (you asked 2 questions)
5. Make sure you have no Autocommit. Blocking.
6. No, it's faster.

"Bob Sparks" <Bo*******@exci te.com> wrote in message
news:9b******** *************** ***@posting.goo gle.com...
Hello

I am running an insert that takes an awfully long time compared to the
same workload on Oracle.
It takes 44 minutes to insert 2.5 million records. It takes less time
to insert the records into the source table loading from disk.
The statement is below as is information about the table space.

So my questions are

1. does the lock affect the insert?
2. would a lock on the target table help?
3. would separate table spaces help/
4. do I have the right buffer size would a larger help?
5. what other parameters can I tweak?
6. is DB2 just slower than Oracle at inserts?

Thanks

Bob

The statements

LOCK TABLE KPI_VALUE_STAGE IN EXCLUSIVE MODE;

INSERT INTO kvsr_temp(YEAR_ NR, TIME_PERIOD_CD, PERIOD_NR, DAY_NR,
KPI_ID,
VALUE_TYPE_CD, KPI_VALUE, CURRENCY_CD,
VALID_AS_AT_DT, KPI_NM, SCORECARD_ID,
SCORECARD_NM,
KPI_CLASS_ID, DATA_SOURCE_ID, DATA_SOURCE_NM,
PARENT_SCORECAR D_ID, QUALIFIER_ID,
QUALIFIER_NM, STAGING_CREATED _DT)
SELECT YEAR_NR, ucase(TIME_PERI OD_CD), PERIOD_NR, DAY_NR, KPI_ID,
VALUE_TYPE_CD, KPI_VALUE, ucase(CURRENCY_ CD),
VALID_AS_AT_DT,
KPI_NM, SCORECARD_ID, SCORECARD_NM, KPI_CLASS_ID,
DATA_SOURCE_ID,
DATA_SOURCE_NM, PARENT_SCORECAR D_ID, QUALIFIER_ID,
QUALIFIER_NM, CREATED_DT
FROM KPI_VALUE_STAGE AS KVS;
Source table is created

NOT LOGGED INITIALLY
IN USERSPACE4K

and the destination table is created

NOT LOGGED INITIALLY
IN USERSPACE4K
it has no indexes but has an identity.

KVSR_TEMP_SID INT GENERATED ALWAYS AS IDENTITY(start with 1, increment
by 1, cache 20000, CYCLE)
NOT NULL,

The buffer pool

CREATE BUFFERPOOL "BP4K"
SIZE 1920
PAGESIZE 4 K
NOT EXTENDED STORAGE

The tablespace

CREATE REGULAR TABLESPACE USERSPACE4K
IN DATABASE PARTITION GROUP IBMDEFAULTGROUP
PAGESIZE 4 K
MANAGED BY SYSTEM
USING ('USERSPACE4K')
EXTENTSIZE 8
PREFETCHSIZE 8
BUFFERPOOL BP4K
DROPPED TABLE RECOVERY ON

Nov 12 '05 #4
Yes, a unit of work is ended with COMMIT or ROLLBACK at which point teh
next unit of work implicitly starts.
The NOT LOGGED INITIALLY property gets reset at teh end of a unit of work.
If you want to do some work not logged maybe global temporary tables are
an option? They can permanently be without logging.

Cheers
Serge
Nov 12 '05 #5

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

Similar topics

8
4259
by: aualias | last post by:
I am rewriting a web page that was previously done with ColdFusion. It has a DataGrid and one column in the DataGrid is a dropdown list which is the same for all rows. The ItemDataBound code looks like this... // _viewDestinations is created once and stored in the ViewState
3
2091
by: Mario Soto | last post by:
Hi. i hava a postresql 7.4.2 in a production server. tha machine is a Pentium IV 2,6 GHZ AND 1 GB IN RAM with lINUX RH 9.0. The postresql.conf say: #--------------------------------------------------------------------------- # RESOURCE USAGE (except WAL) #---------------------------------------------------------------------------
8
4338
by: shenanwei | last post by:
I have 2 same windows machine, same instance configure and Database , all run DB2 UDB V8.1.5 Test 1 : create table OUT_1 (LINE VARCHAR(350), LINENUMBER INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1, NO CACHE)); insert into out_1 (line) values ('C000000002XYTNF102020201855000000075000519600040547000003256510 0000000000000000000000000SIM CAR ADJ JOHN, SMITHJA CPRM SIM CARMBCORL XYTNF1020282726
5
4187
by: PH | last post by:
Hi guys; I got a single processor computer, running an application that launches 2 threads. Each of these threads listens for incoming connections in a specific port, so there is a Loop . Until inside each of them.
2
1040
by: merco | last post by:
hi, is it possible to automatically change default mode to insert if my datasource hasn't any records ? How can i do that ? Thanks
1
2468
by: Ganesh | last post by:
Hi There, I use detailView to edit, insert and delete data. It gets value from datagrid.selectedvalue. How can i insert a record initially. If there is not any record in the grid, still i would like to have Insert from details view. can i do this, please advise me Thanks Ganesh
13
3463
by: eighthman11 | last post by:
using Access 2003 and sql server version 8.0 Hey everyone. Created a text box where the user types in an Inventory number and it takes them to that inventory number on the contimuous form. The form is based on a link table to sql server. Here is the code: Dim rst As DAO.Recordset Dim InventoryItem As String InventoryItem = "'" & "TextBoxValue" & "'"
6
1274
by: Cirene | last post by:
I have VS2008 and the IDE is super slow. I updated to the latest version. Is there a way to find out why it's acting so slow?
12
3105
by: Marc Baker | last post by:
Bear with me here folks, I don't know much MS SQL performance. Wondering if someone can point me in the right direction. I have 1 particular database where queries are slow. To test this theory, I am running a SELECT COUNT(*) on some of the tables that have many rows (2-4 million rows). Example: A table with approx 3.5 million rows, a count takes over 10 mins. to run initially. If I just do a count on the indexed field, SELECT...
0
9712
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
10595
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...
1
10341
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
10089
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
9171
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...
1
7634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5530
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...
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.