473,387 Members | 1,582 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,387 software developers and data experts.

SQL0437W Performance of this complex query may be sub-optimal. Reason code: "1". SQLSTATE=01602

Hi,

We have created triggers to log modifications to tables in our application.
The triggers work fine, just on one of the tables in our database the
triggers fail with the error message <SQL0437W Performance of this complex
query may be sub-optimal. Reason code: "1". SQLSTATE=01602>. The same
trigger on other tables works fine (the triggers are autogenerated with the
same structure for most of the tables used in our application).

I have included the error message, the trigger CREATE code as well as the
table definition below. My Test environment is Windows XP SP2 using DB2 9.5
Express Edition SP1. The database is set to self tuning memory. The database
statistics are executed at regular intervals.

Does anyone have an idea how I can resolve this problem? I do not understand
why this trigger ought to cause sub-optimal performance.

Regards

Rudolf Bargholz
db2level
-----------
C:\>db2level
DB21085I Instance "DB2" uses "32" bits and DB2 code release "SQL09051" with
level identifier "03020107".
Informational tokens are "DB2 v9.5.100.179", "s080328", "WR21402", and Fix
Pack "1".
Product is installed at "C:\PROGRA~1\ONLINE~1\IBM\SQLLIB" with DB2 Copy Name
"DB2OLTSSRV".
SQL Error
------------
[IBM][CLI Driver][DB2/NT] SQL0723N An error occurred in a triggered SQL
statement in trigger "DB2ADMIN.DE_RECHDTL_88". Information returned for the
error includes SQLCODE "-803", SQLSTATE "23505" and message tokens
"1|DB2ADMIN.DATALOG2". SQLSTATE=09000

[IBM][CLI Driver][DB2/NT] SQL0437W Performance of this complex query may be
sub-optimal. Reason code: "1". SQLSTATE=01602
Trigger Code
-----------------
Here the Code that is generated to create the trigger. I have removed all
non-relevant code and simplified the trigger, but the error is still
generated:

create trigger DE_RECHDTL_88
after update of RD_INETPASSWD on RECHEMPFDETAIL
referencing old as olddata new as newdata
for each row mode db2sql
when
(coalesce(olddata.RD_INETPASSWD,'')<>coalesce(newd ata.RD_INETPASSWD,''))
insert into DATALOG2
(
DLG_SEQ,
DLG_USERCODE,
DLG_CSEQ,
DLG_RESEQ,
DLG_SCSEQ,
DLG_PARENTSEQ,
DLG_CHILDSEQ,
DLG_DATE,
DLG_TIMESTAMP,
DLG_COLUMN,
DLG_TABLE,
DLG_ACTION,
DLG_BEFORE,
DLG_AFTER,
DLG_BEFORESEQ,
DLG_AFTERSEQ
)
values
(
NEXTVAL for SEQ_DATALOG2,
'',
'',
'',
'',
'',
'',
current date,
current timestamp,
'RD_INETPASSWD',
'RECHEMPFDETAIL',
1,
'',
'',
'',
''
)
------------------------------------------------
-- DDL Statements for table "DB2ADMIN"."RECHEMPFDETAIL"
------------------------------------------------

CREATE TABLE "DB2ADMIN"."RECHEMPFDETAIL" (
"RD_SEQ" VARCHAR(20) NOT NULL ,
"RD_RSEQ" VARCHAR(20) ,
"RD_NAME" VARCHAR(50) ,
"RD_VORNAME" VARCHAR(50) ,
"RD_PASSNUMMER" VARCHAR(20) ,
"RD_NATIONALITAET" VARCHAR(20) ,
"RD_AUSSTELLUNGSDATUM" DATE ,
"RD_BUERGERORT" VARCHAR(50) ,
"RD_GUELTIGBIS" DATE ,
"RD_AUSSTELLUNGSORT" VARCHAR(50) ,
"RD_TELGESCHAEFTVOR" VARCHAR(10) ,
"RD_TELGESCHAEFT" VARCHAR(50) ,
"RD_TEXT" LONG VARCHAR ,
"RD_TEXTPRIVAT" LONG VARCHAR ,
"RD_NURGARANTIE" SMALLINT ,
"RD_AMEXCO" VARCHAR(15) ,
"RD_AMEXCOEXP" VARCHAR(4) ,
"RD_DINERS" VARCHAR(14) ,
"RD_DINERSEXP" VARCHAR(4) ,
"RD_EUROCARD" VARCHAR(16) ,
"RD_EUROCARDEXP" VARCHAR(4) ,
"RD_UATP" VARCHAR(15) ,
"RD_UATPEXP" VARCHAR(15) ,
"RD_VISA" VARCHAR(16) ,
"RD_VISAEXP" VARCHAR(4) ,
"RD_SR" VARCHAR(9) ,
"RD_AF" VARCHAR(10) ,
"RD_AA" VARCHAR(7) ,
"RD_BA" VARCHAR(8) ,
"RD_DL" VARCHAR(10) ,
"RD_KL" VARCHAR(10) ,
"RD_LH" VARCHAR(16) ,
"RD_UA" VARCHAR(11) ,
"RD_FLUGWEITERE1" VARCHAR(60) ,
"RD_FLUGWEITERE2" VARCHAR(60) ,
"RD_FLUGWEITERE3" VARCHAR(60) ,
"RD_ZIMMERTYP" VARCHAR(60) ,
"RD_HILTON" VARCHAR(9) ,
"RD_HOLIDAYINN" VARCHAR(9) ,
"RD_HYATT" VARCHAR(10) ,
"RD_INTERCONTI" VARCHAR(8) ,
"RD_MARIOTT" VARCHAR(9) ,
"RD_SHERATON" VARCHAR(9) ,
"RD_HOTELWEITERE1" VARCHAR(60) ,
"RD_HOTELWEITERE2" VARCHAR(60) ,
"RD_HOTELWEITERE3" VARCHAR(60) ,
"RD_WAGENKAT" VARCHAR(60) ,
"RD_AVISWIZ" VARCHAR(6) ,
"RD_AVISAWD" VARCHAR(7) ,
"RD_BUDGET" VARCHAR(8) ,
"RD_EUROPCAR" VARCHAR(8) ,
"RD_HERTZNO1" VARCHAR(8) ,
"RD_HERTZCDP" VARCHAR(6) ,
"RD_AUTOWEITERE1" VARCHAR(60) ,
"RD_AUTOWEITERE2" VARCHAR(60) ,
"RD_AUTOWEITERE3" VARCHAR(60) ,
"RD_SITZNICHTRAUCHER" SMALLINT ,
"RD_SITZRAUCHER" SMALLINT ,
"RD_SITZGANG" SMALLINT ,
"RD_SITZFENSTER" SMALLINT ,
"RD_SPEZESSEN" LONG VARCHAR ,
"RD_SITZWUNSCH" LONG VARCHAR ,
"RD_HALBTAX" SMALLINT ,
"RD_GA" SMALLINT ,
"RD_BAHNWEITERE1" VARCHAR(60) ,
"RD_BAHNWEITERE2" VARCHAR(60) ,
"RD_BAHNWEITERE3" VARCHAR(60) ,
"RD_STC" SMALLINT ,
"RD_TAUCHGANG" VARCHAR(4) ,
"RD_BREVET" VARCHAR(10) ,
"RD_GOLD" SMALLINT ,
"RD_SILBER" SMALLINT ,
"RD_REPEATER" SMALLINT ,
"RD_SUSV" SMALLINT ,
"RD_GRUPPE" VARCHAR(6) ,
"RD_BERUF" VARCHAR(60) ,
"RD_ADDITIONAL" LONG VARCHAR ,
"RD_NOGALILEO" SMALLINT ,
"RD_MODUSER" VARCHAR(20) ,
"RD_MODDATE" DATE ,
"RD_CREATEUSER" VARCHAR(20) ,
"RD_CREATEDATE" DATE ,
"RD_CLEARING" VARCHAR(7) ,
"RD_KONTO" VARCHAR(50) ,
"RD_LSV" SMALLINT ,
"RD_AGENT" SMALLINT ,
"RD_LSVMAIL" LONG VARCHAR ,
"RD_INETPASSWD" VARCHAR(20) ,
"RD_INETSECQUESTION" VARCHAR(100) ,
"RD_INETSECANSWER" VARCHAR(100) ,
"RD_APITYPE" VARCHAR(10) ,
"RD_GIATASUPPLCODE" VARCHAR(6) ,
"RD_HALBTAX_VERFALL" DATE ,
"RD_GA_VERFALL" DATE ,
"RD_HALBTAX_LAUFZEIT" SMALLINT ,
"RD_GA_KLASSE" SMALLINT ,
"RD_GA_UEBERTRAG" SMALLINT )
IN "USERSPACE1" ;
-- DDL Statements for indexes on Table "DB2ADMIN"."RECHEMPFDETAIL"

CREATE INDEX "DB2ADMIN"."OLTS1001" ON "DB2ADMIN"."RECHEMPFDETAIL"
("RD_INETPASSWD" ASC)
PCTFREE 10 MINPCTUSED 10
ALLOW REVERSE SCANS;

-- DDL Statements for indexes on Table "DB2ADMIN"."RECHEMPFDETAIL"

CREATE INDEX "DB2ADMIN"."OLTS1002" ON "DB2ADMIN"."RECHEMPFDETAIL"
("RD_APITYPE" ASC)
PCTFREE 10 MINPCTUSED 10
ALLOW REVERSE SCANS;

-- DDL Statements for indexes on Table "DB2ADMIN"."RECHEMPFDETAIL"

CREATE INDEX "DB2ADMIN"."OLTS1029" ON "DB2ADMIN"."RECHEMPFDETAIL"
("RD_GIATASUPPLCODE" ASC)
PCTFREE 10 MINPCTUSED 10
ALLOW REVERSE SCANS;

-- DDL Statements for indexes on Table "DB2ADMIN"."RECHEMPFDETAIL"

CREATE UNIQUE INDEX "DB2ADMIN"."OLTS377" ON "DB2ADMIN"."RECHEMPFDETAIL"
("RD_SEQ" ASC)
PCTFREE 10 MINPCTUSED 10
ALLOW REVERSE SCANS;

-- DDL Statements for indexes on Table "DB2ADMIN"."RECHEMPFDETAIL"

CREATE INDEX "DB2ADMIN"."OLTS378" ON "DB2ADMIN"."RECHEMPFDETAIL"
("RD_RSEQ" ASC)
PCTFREE 10 MINPCTUSED 10
ALLOW REVERSE SCANS;

-- DDL Statements for indexes on Table "DB2ADMIN"."RECHEMPFDETAIL"

CREATE INDEX "DB2ADMIN"."OLTS379" ON "DB2ADMIN"."RECHEMPFDETAIL"
("RD_AGENT" ASC)
PCTFREE 10 MINPCTUSED 10
ALLOW REVERSE SCANS;


Jun 27 '08 #1
1 15841
I think you are on a wild goose chase with that +437 warning.
Your problem is the -803 raised by the trigger.
Your trigger obviosuly doesn't match the rest of the DDL (column names
don't match). So that's as far as I can help at this point.
You can ignore the +437.

Cheers
Serge
----
db2 =? SQL803;
SQL0803N One or more values in the INSERT statement, UPDATE statement,
or foreign key update caused by a DELETE statement are not valid
because the primary key, unique constraint or unique index
identified by "<index-id>" constrains table "<table-name>" from
having duplicate values for the index key.

Explanation:

The INSERT or UPDATE object table "<table-name>" is constrained by one
or more UNIQUE indexes to have unique values in certain columns or
groups of columns. Alternatively, a DELETE statement on a parent table
caused the update of a foreign key in a dependent table "<table-name>"
that is constrained by one or more UNIQUE indexes. Unique indexes might
support primary keys or unique constraints defined on a table. The
statement cannot be processed because completing the requested INSERT,
UPDATE or DELETE statement would result in duplicate column values. If
the index is on an XML column, the duplicate values for the index key
may be generated from within a single XML document.

Alternatively, if a view is the object of the INSERT or UPDATE
statement, it is the table "<table-name>" on which the view is defined
that is constrained.

If "<index-id>" is an integer value, the index name can be obtained from
SYSCAT.INDEXES by issuing the following query:

SELECT INDNAME, INDSCHEMA
FROM SYSCAT.INDEXES
WHERE IID = <index-id>
AND TABSCHEMA = 'schema'
AND TABNAME = 'table'

where schema represents the schema portion of "<table-name>" and table
represents the table name portion of "<table-name>".

The statement cannot be processed. The table remains unchanged.
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jun 27 '08 #2

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

Similar topics

4
by: Christoph Bisping | last post by:
Hello! I'm seeking advice on a rather complex type of query I need to build in an Access ADP (SQL-Server 7). There are four tables: tblPeople ID(PK) PRENAME --------------- 1 Thomas 2 Frank
3
by: Not Me | last post by:
Hi, Can't post specifics at the moment but if this seems like a common problem any help would be appreciated. When querying with ~6 tables, using mostly left outer joins, I get standard...
9
by: shorti | last post by:
db2 V8.2 I have been looking for a good way to log the 'reason code' when we hit an sqlcode that uses them. From what I can tell the reason code is stored in sqlca.sqlerrmc. But, there seems...
1
by: Lennart | last post by:
While investigating deadlocks in an application I wrote a function to check if there where any batchjobs running in parallell at the time of the deadlocks. The check runs surprisingly fast, but If...
3
blyxx86
by: blyxx86 | last post by:
Hey there, I'm running into a slight problem today... I have a few things to show... I'm running into duplicate values being shown in my query, but I cannot use a "Select DISTINCT" as it...
0
crystal2005
by: crystal2005 | last post by:
Hi, I am having trouble with some complex SQL queries. I’ve got winestore database, taken from Web Database Application with PHP and MySQL book. And some question about queries as the following ...
2
BeemerBiker
by: BeemerBiker | last post by:
I put together a (what I consider) complex query using the Access wizard. It works fine in access but fails when I code it up. I can actually make it work in code by "simplifying" it, but then it...
3
by: william67 | last post by:
I'm having a hard time building a query to do what I need to do and was hoping some genius could help me out, I need to do a complex query and any and all help is much appreciated this is the...
0
by: Kozy | last post by:
Hello everyone, i have a big problem with imports. I have only see this problem on 9.5, i have never goten it on 9.1. 99% of time db2 works great ( version 9.5 fixpack 5 ) on windows 2008 (...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
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.