473,722 Members | 2,484 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\ON LINE~1\IBM\SQLL IB" 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_RE CHDTL_88". Information returned for the
error includes SQLCODE "-803", SQLSTATE "23505" and message tokens
"1|DB2ADMIN.DAT ALOG2". 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(oldda ta.RD_INETPASSW D,'')<>coalesce (newdata.RD_INE TPASSWD,''))
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"."REC HEMPFDETAIL"
------------------------------------------------

CREATE TABLE "DB2ADMIN"."REC HEMPFDETAIL" (
"RD_SEQ" VARCHAR(20) NOT NULL ,
"RD_RSEQ" VARCHAR(20) ,
"RD_NAME" VARCHAR(50) ,
"RD_VORNAME " VARCHAR(50) ,
"RD_PASSNUM MER" VARCHAR(20) ,
"RD_NATIONALITA ET" VARCHAR(20) ,
"RD_AUSSTELLUNG SDATUM" DATE ,
"RD_BUERGER ORT" VARCHAR(50) ,
"RD_GUELTIG BIS" DATE ,
"RD_AUSSTELLUNG SORT" VARCHAR(50) ,
"RD_TELGESCHAEF TVOR" VARCHAR(10) ,
"RD_TELGESCHAEF T" VARCHAR(50) ,
"RD_TEXT" LONG VARCHAR ,
"RD_TEXTPRI VAT" LONG VARCHAR ,
"RD_NURGARANTIE " SMALLINT ,
"RD_AMEXCO" VARCHAR(15) ,
"RD_AMEXCOE XP" VARCHAR(4) ,
"RD_DINERS" VARCHAR(14) ,
"RD_DINERSE XP" VARCHAR(4) ,
"RD_EUROCAR D" 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_FLUGWEITERE 1" VARCHAR(60) ,
"RD_FLUGWEITERE 2" VARCHAR(60) ,
"RD_FLUGWEITERE 3" VARCHAR(60) ,
"RD_ZIMMERT YP" VARCHAR(60) ,
"RD_HILTON" VARCHAR(9) ,
"RD_HOLIDAY INN" VARCHAR(9) ,
"RD_HYATT" VARCHAR(10) ,
"RD_INTERCO NTI" VARCHAR(8) ,
"RD_MARIOTT " VARCHAR(9) ,
"RD_SHERATO N" VARCHAR(9) ,
"RD_HOTELWEITER E1" VARCHAR(60) ,
"RD_HOTELWEITER E2" VARCHAR(60) ,
"RD_HOTELWEITER E3" VARCHAR(60) ,
"RD_WAGENKA T" VARCHAR(60) ,
"RD_AVISWIZ " VARCHAR(6) ,
"RD_AVISAWD " VARCHAR(7) ,
"RD_BUDGET" VARCHAR(8) ,
"RD_EUROPCA R" VARCHAR(8) ,
"RD_HERTZNO 1" VARCHAR(8) ,
"RD_HERTZCD P" VARCHAR(6) ,
"RD_AUTOWEITERE 1" VARCHAR(60) ,
"RD_AUTOWEITERE 2" VARCHAR(60) ,
"RD_AUTOWEITERE 3" VARCHAR(60) ,
"RD_SITZNICHTRA UCHER" SMALLINT ,
"RD_SITZRAUCHER " SMALLINT ,
"RD_SITZGAN G" SMALLINT ,
"RD_SITZFENSTER " SMALLINT ,
"RD_SPEZESS EN" LONG VARCHAR ,
"RD_SITZWUN SCH" LONG VARCHAR ,
"RD_HALBTAX " SMALLINT ,
"RD_GA" SMALLINT ,
"RD_BAHNWEITERE 1" VARCHAR(60) ,
"RD_BAHNWEITERE 2" VARCHAR(60) ,
"RD_BAHNWEITERE 3" VARCHAR(60) ,
"RD_STC" SMALLINT ,
"RD_TAUCHGA NG" VARCHAR(4) ,
"RD_BREVET" VARCHAR(10) ,
"RD_GOLD" SMALLINT ,
"RD_SILBER" SMALLINT ,
"RD_REPEATE R" SMALLINT ,
"RD_SUSV" SMALLINT ,
"RD_GRUPPE" VARCHAR(6) ,
"RD_BERUF" VARCHAR(60) ,
"RD_ADDITIO NAL" LONG VARCHAR ,
"RD_NOGALIL EO" SMALLINT ,
"RD_MODUSER " VARCHAR(20) ,
"RD_MODDATE " DATE ,
"RD_CREATEU SER" VARCHAR(20) ,
"RD_CREATED ATE" DATE ,
"RD_CLEARIN G" VARCHAR(7) ,
"RD_KONTO" VARCHAR(50) ,
"RD_LSV" SMALLINT ,
"RD_AGENT" SMALLINT ,
"RD_LSVMAIL " LONG VARCHAR ,
"RD_INETPAS SWD" VARCHAR(20) ,
"RD_INETSECQUES TION" VARCHAR(100) ,
"RD_INETSECANSW ER" VARCHAR(100) ,
"RD_APITYPE " VARCHAR(10) ,
"RD_GIATASUPPLC ODE" VARCHAR(6) ,
"RD_HALBTAX_VER FALL" DATE ,
"RD_GA_VERF ALL" DATE ,
"RD_HALBTAX_LAU FZEIT" SMALLINT ,
"RD_GA_KLAS SE" SMALLINT ,
"RD_GA_UEBERTRA G" SMALLINT )
IN "USERSPACE1 " ;
-- DDL Statements for indexes on Table "DB2ADMIN"."REC HEMPFDETAIL"

CREATE INDEX "DB2ADMIN"."OLT S1001" ON "DB2ADMIN"."REC HEMPFDETAIL"
("RD_INETPASSWD " ASC)
PCTFREE 10 MINPCTUSED 10
ALLOW REVERSE SCANS;

-- DDL Statements for indexes on Table "DB2ADMIN"."REC HEMPFDETAIL"

CREATE INDEX "DB2ADMIN"."OLT S1002" ON "DB2ADMIN"."REC HEMPFDETAIL"
("RD_APITYPE " ASC)
PCTFREE 10 MINPCTUSED 10
ALLOW REVERSE SCANS;

-- DDL Statements for indexes on Table "DB2ADMIN"."REC HEMPFDETAIL"

CREATE INDEX "DB2ADMIN"."OLT S1029" ON "DB2ADMIN"."REC HEMPFDETAIL"
("RD_GIATASUPPL CODE" ASC)
PCTFREE 10 MINPCTUSED 10
ALLOW REVERSE SCANS;

-- DDL Statements for indexes on Table "DB2ADMIN"."REC HEMPFDETAIL"

CREATE UNIQUE INDEX "DB2ADMIN"."OLT S377" ON "DB2ADMIN"."REC HEMPFDETAIL"
("RD_SEQ" ASC)
PCTFREE 10 MINPCTUSED 10
ALLOW REVERSE SCANS;

-- DDL Statements for indexes on Table "DB2ADMIN"."REC HEMPFDETAIL"

CREATE INDEX "DB2ADMIN"."OLT S378" ON "DB2ADMIN"."REC HEMPFDETAIL"
("RD_RSEQ" ASC)
PCTFREE 10 MINPCTUSED 10
ALLOW REVERSE SCANS;

-- DDL Statements for indexes on Table "DB2ADMIN"."REC HEMPFDETAIL"

CREATE INDEX "DB2ADMIN"."OLT S379" ON "DB2ADMIN"."REC HEMPFDETAIL"
("RD_AGENT" ASC)
PCTFREE 10 MINPCTUSED 10
ALLOW REVERSE SCANS;


Jun 27 '08 #1
1 15980
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
2072
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
1635
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 performance with the where clause where XXX is not null
9
6707
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 to be other information stored in this string besides the reason code. The DB2 Info Center website states that sqlca.sqlerrml identifies whether sqlerrmc contains valid data and the length of the data so I added code that would copy the content...
1
5025
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 I narrow the searchspace I start getting SQL0437W with reason code 3 "Optimizer cost underflow". Statistics are up to date on the table. Is this something to worry about, or can the warning be ignored? /Lennart
3
1761
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 removes the records... It's a complex query, so I'm including 3 parts.. an image of the joins, an example of the duplicate values and the SQL. SELECT tblRequest.CustomerTracking, tblRequest.ReqDate, tblLocations.LocationCode,...
0
2452
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 1. The wine name, grape variety, year, winery, and region 2. The minimum cost of wine in the inventory 3. The number of bottles available at the minimum price 4. The total number of bottles available at any price 5. The total number of unique...
2
1761
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 does not do exactly what I want it to do. The following works fine if I click on ! and run it. http://swri.info/images/cmplxqry1_works.png Ok - after verifying the above works, I put the part before the "WHERE" into ads4any.SelectCommand and put...
3
2203
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 table, with sample data ------------------ | x_id | y_id | ------------------ | 3 | 9 | ------------------ | 1 | 2 |
0
2431
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 ( microsoft cluster solution ). When we do imports we get the following error ( once in a while ... but it is frequent enough to worry us ). Error from log:
0
8739
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
9384
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
9238
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
9157
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
9088
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...
1
6681
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
5995
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();...
1
3207
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
2147
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.