473,799 Members | 3,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

db2 trigger and foreign key constraint perfomace issue

1 New Member
Hi,

I m very new to DB2.
I m facing problem while creating a trigger on a table which has 5 milllions row

I am using stored procedure to update this table like this

update tan_detail set lst_id = 'RECFDM' where ack_no = in_parameter;

where ack_no has index created on it.

And calling this procedure using jdbc and it is taking 1 to 2 millisecond to complete (time calulated using java date time function).

But when i create simple trigger on this table like



CREATE TRIGGER PLT_STUPD_UPD AFTER UPDATE ON TAN_DETAIL
REFERENCING NEW AS N FOR EACH ROW MODE DB2SQL WHEN (N.LST_ID = 'HDDELV')
BEGIN ATOMIC

DECLARE LLST_ID VARCHAR(6);
DECLARE CNT INTEGER DEFAULT 0;

-- SET LLST_ID = LTRIM(RTRIM(VAL UE(N.LST_ID,'') ));



END
@

The time taken to run this procedure is increased to 250 to 400 millisecond and
we need to call this procedure 50000 thousand time during EOD and BOD. So it is not affordable.

Same perfomace degradation is noticed when i crate foreing key on lst_id column references to lcm_status_mast er which has 40 rows and reverse scan index also created on lst_id column

Any suggetion to solve this problem is very helpful or by defaul DB2 suffers performacne laking when creating trigger or foreing key?

Thx in advance

Devang.
Sep 9 '06 #1
0 2050

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2241
by: Jason | last post by:
I have a table, SecurityMasterUnderlying, that has a 2 foreign key constraints to the same table (SecurityMaster). The first one is a one-to-one relationship. The second being a many-to-one. * All securities (equities, options, futures) will have ONE row in SecurityMaster. * All derivatives (options) will also have ONE row in SecurityMasterUnderlying. * All derivatives will have an underlying security (think of it as a parent) in...
9
8029
by: Fernand St-Georges | last post by:
Hi, can someone tell how to write a Trigger; I am familiar with Sybase Sql Anywhere trigger syntax. Actually I have three tables MEMBER, CONTRACT and PAYMENT I need to update the MEMBER.BALANCE once the PAYMENT.AMOUNT is INSERTED where PAYEMENT.CONTRAC_ID = CONTRACT.CONTRAC_ID and CONTRAT.MEMBER_ID = MEMBRE.MEMBER_ID I have more TRIGGERS to write, but with a good example it would be great
7
21457
by: Justin | last post by:
I am extremely new at SQL Server2000 and t-sql and I'm looking to create a simple trigger. For explanation sake, let's say I have 3 columns in one table ... Col_1, Col_2 and Col_3. The data type for Col_1 and Col_2 are bit and Col_3 is char. I want to set a trigger on Col_2 to compare Col_1 to Col_2 when Col_2 is updated and if they're the same, set the value on Col_3 to "Completed". Can someone please help me? Thanks, Justin
7
1767
by: rkrueger | last post by:
Given the following 3 Tables: CREATE TABLE ( NOT NULL , NOT NULL CONSTRAINT DEFAULT (getdate()), NULL , CONSTRAINT PRIMARY KEY CLUSTERED (
5
3968
by: Peter Erickson | last post by:
I am running postgresql 7.4.2 and having problems creating a trigger function properly. I keep getting the following error: ERROR: OLD used in query that is not in rule I have a table called journal_entries with a foreign key to a table called journals. When a entry is added to journal_entries, I am trying to get it to update the 'mtime' field of the corresponding entry in the journals table.
1
1934
by: Bastian Blank | last post by:
I'm using postgresql 7.4.2 and COPY FROM don't trigger INSERT rules. Definitions: | CREATE TABLE log.package_status ( | version integer NOT NULL, | architecture integer NOT NULL, | distribution integer NOT NULL, | status_old integer, | time timestamp NOT NULL, | UNIQUE (version, architecture, distribution, time)
1
4588
by: Robert Fitzpatrick | last post by:
I am running PostgreSQL 7.4.5 and have a trigger on a table called tblriskassessors which inserts, updates or delete a corresponding record in tblinspectors by lookup of a contact id and license number match. The INSERT and DELETE work fine. The UPDATE works good unless I update the license number. The error, at the bottom of this message, suggests the primary key violation. But my UPDATE in no way alters the primary key, which is...
8
7883
by: Benzine | last post by:
Hi, I have an issue with my replication at the moment. I will try to describe the scenario accurately. I am using MS SQL 2000 SP4 with Merge Replication. Subscribers connect to the publisher to upload/download changes. I have a trigger set up on one table which updates another, here is an example of the trigger: "CREATE TRIGGER qt_t_projTotal ON dbo.qt_quotes
3
5970
by: Wojto | last post by:
Hi there! I need to write a trigger that will check referential integrity of my data. I have few FOREIGN KEY constraints but, as You probably konow, the cannot be deferred (in the meaning of SQL 92 standard). So I decided to add NOCHECK CONSTRAINT ALL to the modified table and then run a trigger (after secon altertion of my table). But I cannot write a trigger for ALTER. I found something on msdn, byt their example doesn't work. To show...
0
9541
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
10485
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
10252
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...
0
9073
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
7565
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
5463
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
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
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
3
2938
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.