|
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-
bounces@xxxxxxxxxxxx] On Behalf Of Elvis Budimlic
Sent: Friday, February 08, 2008 1:06 PM
To: 'Midrange Systems Technical Discussion'
Subject: RE: SQL Update Performance
Even with ADDRINP being a primary dial, I would expect better performance.
V5R2 isn't supported, otherwise I'd advise pinging IBM.
As it stands and being that Mark said regular SELECT performs well, you
can
try using updateable cursor inside an embedded SQL program (specifying FOR
UPDATE OF and then WHERE CURRENT OF). For example:
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/sqlp/rbafyupda
ti
ngasretrieved.htm
I think in this specific case something like this might work (forgive my
clumsy attempt at RPG):
DECLARE forupdateof CURSOR FOR
SELECT Addr1
FROM ADDRINP
WHERE akey in (select ctradr
from contrcp
where cinact = 'CC01')
FOR UPDATE OF Addr1;
EXEC SQL
OPEN forupdateof
END-EXEC.
/* fetch all (6) records in a loop and as you go update the field */
EXEC SQL
FETCH forupdateof INTO hvAddr1
END-EXEC.
while (sqlca.sqlcode is still good (i.e. >= 0 and not equal to 100))
EXEC SQL
UPDATE ADDRINP
SET Addr1 = 'this is a test'
WHERE CURRENT OF forupdateof
END-EXEC.
/* still inside the loop, fetch next record */
EXEC SQL
FETCH forupdateof INTO hvAddr1
END-EXEC.
/* outside the loop */
EXEC SQL
CLOSE forupdateof
END-EXEC.
Mark mentioned Java, so he can try it there instead of RPG or C or...
Let me know if this perform any better.
HTH, Elvis
Celebrating 11-Years of SQL Performance Excellence on IBM i5/OS and OS/400
www.centerfieldtechnology.com
-----Original Message-----
Subject: RE: SQL Update Performance
Elvis,
Since this a an update query and we're at v5r2, isn't the CQE always used?
It seems we're pretty much SOL. The query engine insists on joining
ADDRINP
in position 1, since
there's an IN predicate and a subselect involved. At least at v5r2.
Perhaps the QE would be smarted
at v5r3, v5r4, v6r1.
Charles Wilt
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.