Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
164 views16 pages

TS004366894-Update Command Is Very Slow

This support case history is regarding a slow update command issue. The case was initially closed due to inactivity but later reopened to discuss workarounds. IBM support suggested using a global temporary table to improve performance. The customer tried this and saw improvements but still had questions about why updates were slow. IBM support provided further analysis and suggestions to rewrite the statement or add a primary key to avoid row compensation and improve columnar processing.

Uploaded by

Trần Nga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
164 views16 pages

TS004366894-Update Command Is Very Slow

This support case history is regarding a slow update command issue. The case was initially closed due to inactivity but later reopened to discuss workarounds. IBM support suggested using a global temporary table to improve performance. The customer tried this and saw improvements but still had questions about why updates were slow. IBM support provided further analysis and suggestions to rewrite the statement or add a primary key to avoid row compensation and improve columnar processing.

Uploaded by

Trần Nga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

8 March 2021

IBM Support
Support case history
TS004366894 - Update command is very slow

Case history

28 Jan 2021
12:45 PM automatedprocess (IBM) changed Status from Closed by IBM to Closed - Archived.

29 Dec 2020
12:44 PM Aditya.Mudholkar (IBM) changed Status from Awaiting your feedback to Closed by IBM.
12:44 PM Aditya.Mudholkar (IBM)
Thank you for working with us. This case has now been closed due to inactivity. I hope that the suggestions made were
helpful, and that the issue reported is no longer occurring. If you determine this issue needs additional attention, you
can reopen this case within the next 30 days.
If you receive a survey from IBM after this case closes, please take a few minutes to respond. Your candid feedback is
extremely valuable as we strive to deliver the best technical support possible and exceed your expectations.
Thank you for using IBM

26 Dec 2020
11:54 AM Aditya.Mudholkar (IBM)
Hi Team,
I am touching base on the status of this case. According to our experts, the workaround (Declare Global Temporary
Table) needs to be applied in all cases that give performance problem due to DOID2/RAISE_ERROR limitation.
Moreover we will possibly look to close this case on 29 Dec if there is no query in this regard.
Thanks,
Aditya

23 Dec 2020
04:01 PM Aditya.Mudholkar (IBM) changed Status from IBM is working to Awaiting your feedback.
12:03 PM Aditya.Mudholkar (IBM) changed Status from Awaiting your feedback to IBM is working.
12:03 PM Aditya.Mudholkar (IBM)
Hello Team,
I have re-confirmed with our experts one more time.
According to them, you need to use the workaround (Declare Global Temporary Table) in all cases that give
performance problem due to DOID2/RAISE_ERROR limitation.
Let me know if we can close this case.
Thanks,
Aditya

16 Dec 2020
07:17 PM Aditya.Mudholkar (IBM) changed Status from Waiting for IBM to Awaiting your feedback.
07:17 PM Aditya.Mudholkar (IBM)
HI Team,
Actually our experts are working on on this error which should improve things in v11.5.6 but this may take some time.
The suggestion to use the DGTT (declare global temporary table) is to provide relief for the slow update
Thanks,
Aditya
05:18 PM Vietcombank IT Center (Customer) changed Status from Awaiting your feedback to Waiting for IBM.
05:18 PM Vietcombank IT Center (Customer)
Hello!
Why used global temporary table is faster in this case? the query is pass the raise_error function ??
Before that, i tried to change table from column organized to row organized, but the query is slow.
Thanks
04:29 PM Aditya.Mudholkar (IBM) changed Status from IBM is working to Awaiting your feedback.
04:29 PM Aditya.Mudholkar (IBM)

Page 1
8 March 2021

IBM Support
Support case history
Hello Team,
There is no real documentation for how we internally implement the SQL0788N error checking.
We only have the explanation of the error:
https://www.ibm.com/support/knowledgecenter/SSEPGG_11.5.0/com.ibm.db2.luw.messages.sql.doc/com.ibm.db2.luw.messages.s

Thanks,
Aditya
12:31 PM Aditya.Mudholkar (IBM) changed Status from Waiting for IBM to IBM is working.
07:45 AM Vietcombank IT Center (Customer) changed Status from Awaiting your feedback to Waiting for IBM.
07:45 AM Vietcombank IT Center (Customer)
Hi IBM support!
Please give me the document for this issue (SQL0788 error checking mechanism)
Thanks
Regards.

15 Dec 2020
05:02 PM Aditya.Mudholkar (IBM) changed Status from Waiting for IBM to Awaiting your feedback.
05:02 PM Aditya.Mudholkar (IBM)
Hello Team,
The reason for the slowness is the SQL0788 error checking mechanism, injects the raise_error scalar function into the
plan.
This raise_error function is not implemented in the columnar engine, so it moves the data into row store. This in itself is
not that slow, but when it then needs to perform the update, it needs to move things back into the columnar engine
instead of being able to perform things natively in the columnar engine.
Our internal teams are working to get this implemented which should improve things in v11.5.6 but this may take some
time.
Let me know if you are actively looking for a fix.
Thanks,
Aditya
01:33 PM Vietcombank IT Center (Customer) changed Status from Awaiting your feedback to Waiting for IBM.
01:32 PM Vietcombank IT Center (Customer)
Hi IBM support!
We used global temporary table and the query is faster before i open this case:
-Change to delete-insert statement
-Use global temporary table(we choosen)
But My question in this case is"Why the update query is very slow and how to improve the update query performance?"
On netezza machine this query only takes 3 minutes (same tables, same rows) but in IIAS it's very slow!
Thanks for your support!
Regards.
12:43 PM Aditya.Mudholkar (IBM) changed Status from IBM is working to Awaiting your feedback.
12:43 PM Aditya.Mudholkar (IBM)
Hello Team,
Our experts have tested the rewrite with the DGTT and it does work and should be faster. Here there are 2 significant
changes :

1. we need 2 statements now


2. the assumption is that it is ok to rejoin on column GLACCT, this condition needs to be rechecked to see if it is
logically correct.

Could you please try the following (User : db2inst1 ) :-


drop table session.forupdate_dgtt ;
declare global temporary table forupdate_dgtt as
( select MAKHACHHANG, GLACCT
from
( SELECT B.MAKHACHHANG, A.GLACCT FROM NZ_VCB_PAR.FTP_TAPHOPGL_GIAODICH_FIX2 B ,
NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX A
WHERE ISDELETED = 'N' AND A.GLACCT <> 0 AND STRLEFT(A.GLACCT, LENGTH(TRIM(B.SOTAIKHOAN))) =
B.SOTAIKHOAN
) ) with data on commit preserve rows distribute by hash ( GLACCT )
;
UPDATE NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX A SET A.MATAPHOP = B.MAKHACHHANG
from ( select max(MAKHACHHANG) MAKHACHHANG, GLACCT from session.forupdate_dgtt group by GLACCT ) B
where A.GLACCT = B.GLACCT ;

Page 2
8 March 2021

IBM Support
Support case history
Let us know the once you attempted the work around.
Thanks,
Aditya

14 Dec 2020
10:51 AM Aditya.Mudholkar (IBM) changed Status from Waiting for IBM to IBM is working.
10:51 AM Aditya.Mudholkar (IBM)
Hello Team,
Thanks for uploading the logs. We'll analyse the logs and get back to you soon.
Thanks,
Aditya
07:48 AM Vietcombank IT Center (Customer)
Hi IBM support!
Please help to check attatch file Log_20201211.rar
Thanks for your support!
Regards.

11 Dec 2020
05:43 PM Aditya.Mudholkar (IBM)
Hello Team,
We extracted the uploaded log_20201211.zip file, but there are no files found inside the directory.
Please re-upload it with the relevant logs.
Thanks,
Aditya
05:21 PM Vietcombank IT Center (Customer)
Hi IBM support!
Please help to check attatch file Log_20201211.rar
Thanks for your support!
Regards.

10 Dec 2020
03:45 PM Aditya.Mudholkar (IBM)
Hello Team,
From the analysis done so far, it's been believed that the real problem is row compensation mode driven by the check
for duplicates coming out of the subselect.
The raise_error udf call is not implemented in the columnar engine and triggers this issue.
Could you please try and confirm us the following 2 things :-

1. Rewrite the update statement so that we ensure there are no duplicates e.g. like this :

UPDATE NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX A SET A.MATAPHOP = B.MAKHACHHANG


FROM
(SELECT B.SOTAIKHOAN, MAX(B.MAKHACHHANG)
*
FROM
NZ_VCB_PAR.FTP_TAPHOPGL_GIAODICH_FIX
WHERE
ISDELETED = 'N'
Group by B.SOTAIKHOAN
)B
WHERE
A.GLACCT <> 0 AND
STRLEFT(A.GLACCT, LENGTH(TRIM(B.SOTAIKHOAN))) = B.SOTAIKHOAN;
---OR---
2. : Add an informational primary key constraint on column SOTAIKHOAN from table
NZ_VCB_PAR.FTP_TAPHOPGL_GIAODICH_FIX.
Note that this should only be done if there are genuinely no duplicates.
3 : Please generate & upload the plan for the group by rewrite as the performance tested ?
a) db2 connect to <db>

Page 3
8 March 2021

IBM Support
Support case history
b) db2 set current explain mode explain
c) db2 -tvf stmt.sql ( stmt.sql contains query whose access plan is to be generated)
d) db2 set current explain mode no
e) db2exfmt -d <db> -g TIC -1 -o plan_of_stmt.out
Moreover, please upload the db2look for table NZ_VCB_PAR.FTP_TAPHOPGL_GIAODICH_FIX.
All of these tasks can be done by user db2inst1
Thanks,
Aditya

8 Dec 2020
01:03 PM Aditya.Mudholkar (IBM)
Hello Team,
Thanks for the attempting the db2dart. But for now its not needed. Our internal teams are investigating
through the uploaded data that we have at the moment. I will update you soon, once I hear back from them in this
regard.
Thanks,
Aditya

7 Dec 2020
05:00 PM Vietcombank IT Center (Customer)
Dear IBM support!
IIAS machine have 3 nodes, the NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX table on TS4CONSOLE table
sapce in node 2. i get tablespace id is 9 in node2
If i run command on node1, it's return error: invalid tablespace ID 9 then i ssh to node2
The query:
db2dart <dbname> /DC /TSI <table space id> /OI NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX /NP 0 /PS 0 /V
Y /DIC /RPTN dart.report.txt /SCR M
The result:Error An invalid input value was provided for the /OI parameter
What is /OI parameter-object id? and how to get value of object id to pass the /OI parameter?
IF i set /io to 4 and add /TN parameter before the table name like:
db2dart <dbname> /DC /TSI 9 /OI 4 /TN NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX /NP 0 /PS 0 /V Y /DIC
/RPTN dart.report.txt /SCR M
The return : table name data unavailable use object id instead of name as input.
Please help to check this issue!

Thanks for your support!


Regards

4 Dec 2020
03:25 PM Vietcombank IT Center (Customer)
Dear IBM support!
Our current job is also a lot. If you want more information please list all details the task (step by step)
Then my administrator team will follow up on your request and send all infomation for you, but this is the last time or you
must open your webex
The next monday they will run the db2dart command and send the result for you.

Thanks and regards.


11:32 AM Aditya.Mudholkar (IBM)
Hello Team,
You can run the db2dart command via db2inst1 user.
Thanks,
Aditya
10:25 AM Vietcombank IT Center (Customer)
Dear ibm support team!
What's user to run db2dart command? db2inst1 or bluadmin?
With NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX table, we created table then load data from
NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX to table end
then done update command.
This is a little command sample have got in the procedure!
Thanks and regards.

Page 4
8 March 2021

IBM Support
Support case history

3 Dec 2020
03:52 PM Aditya.Mudholkar (IBM)
Hello Team,
According to our experts, there is histogram builder in the trace messages which is not unusual, it just suggests that we
are actively creating the dictionary while the data is being inserted/updated. Now it seems like we might be using
syncADC while creating the dictionary. Per the db2diag.log posted on 22nd Oct and there is no syncADC success
messages for NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX table. In this case it will be useful to see if the
dictionary is already created or not on the table today. If the dictionary is already created then we should not be seeing
these histogram builders.
To check if the dictionary is already created or not, could you please run the db2dart command on the
NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX table, especially we are interested in /DIC option which dumps
the dictionary information as well. :-
db2dart <dbname> /DC /TSI <table space id> /OI NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX /NP 0 /PS 0 /V
Y /DIC /RPTN dart.report.txt /SCR M
( The tablespace id will be for NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX table. )
Moreover, we want to know the following details :-
1) When an update query is run, do you commit the NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX table
creation or not? If not can we first create the NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX table and then run
the update command?
2)If the table creation is already committed then are you using alter table command to activate "Not Logged Initially"
attribute?
We need to know why are inserts/updates triggering syncADC instead of more efficient vectorizedADC.
Thanks,
Aditya

2 Dec 2020
03:07 PM Vietcombank IT Center (Customer)
Hello Aditya!
Please help to check log files- log_20201202.rar
Thanks for your support!
Regards

1 Dec 2020
05:23 PM Aditya.Mudholkar (IBM)
Hello Team,
1) Run the problematic update query in a session.
2) Get the agent id of this query through another session. Below query will help to find out the update query and app.
handle.
db2 "select * from TABLE(MON_GET_ACTIVITY(NULL,-2)) ORDER BY APPLICATION_HANDLE, MEMBER"
( Look for the correct UPDATE statement in STMT_TEXT column and capture its app. handle accordingly )
3) Now run the script as (in another session) :- data.ksh <apphdl. which you captured above>
4) Please make sure it's run from a directory which is writable by all members.
It would be worth getting 3-5 iterations of running the script maybe 5 or 10 minutes apart. You can perform this task via
user 'db2inst1'.
Thanks,
Aditya
04:30 PM Vietcombank IT Center (Customer)
Hello!
Do you have able to ascertain the cause and solution of the issue yet?
If you'd like me to help you, Please give me the directions step by step!
Thank and regards
12:26 PM Aditya.Mudholkar (IBM)
Hello Team,
We have looked through the logs & detected that the correct app handle wasn't used, as the stacks for the agent that
were collected show just an idle agent, and the trace does not show any activity (other than coordinator agent again
waiting in idle state). So it could be the wrong app handle was used - of course we would want the app handle for the
connection running the problematic update statement.
Per the mon_get_activity output, only one connection with a current activity, this wasn't an update, it was just one of the
mon queries executing.

Page 5
8 March 2021

IBM Support
Support case history
STMT_TEXT ----------- ---------------------------- ------------------------------- --------------------- ----------------
---------------------------------------------------------------------------------------------------------------- - - - 0 0 select * from
TABLE(MON_GET_ACTIVITY(NULL,-2)) ORDER BY APPLICATION_HANDLE, MEMBER
So it looks like the database was basically idle at least when this output was run.
Note :-
You can use the following query for identifying the accurate application handle of problematic UPDATE query.
Verify the correct UPDATE statement in STMT_TEXT column :-
db2 "select * from TABLE(MON_GET_ACTIVITY(NULL,-2)) ORDER BY APPLICATION_HANDLE, MEMBER"
Thanks,
Aditya

30 Nov 2020
07:53 AM Vietcombank IT Center (Customer)
Hello
Please try to open Log_201127.rar
Thanks&Regards

27 Nov 2020
04:39 PM Aditya.Mudholkar (IBM)
Hello Team,
We are unable to open the uploaded log.7z file. Could you please upload the collected logs in .tar.gz format.
Thanks,
Aditya
03:22 PM Vietcombank IT Center (Customer)
Hi Aditya!
The data collection in attach log.7z files
Please help to check!

Thanks&Regards

26 Nov 2020
12:18 PM Vietcombank IT Center (Customer)
Hi Aditya
Administrator team is busy now.
I will send the result for you when i receive the new information from Administrator team.
Thanks for your support!
Regards

25 Nov 2020
07:45 PM Aditya.Mudholkar (IBM)
Hello Team,
Yes, the sql statement is perfect for determining the app. handle of your update query.
You can verify that app. handle using command :- db2 get snapshot for application agentid <app. handle>
(Look for "statement text:" in the above output & see whether it shows your update query )
Thanks,
Aditya
07:26 PM Vietcombank IT Center (Customer)
Hello
data.ksh <apphdl>
With apphdl get from this command?
select application_handle, application_name, application_id, member, rows_read
from table(sysproc.mon_get_connection(sysproc.mon_get_application_handle(), -1))
as conn
Regards.
04:46 PM Aditya.Mudholkar (IBM)
Hello Team,
Thanks for the update. We won't need any downtime in this issue. Our experts just need the following data (as
requested earlier)
to investigate the issue :- (Last time we detected that app. handle was not specified with data.ksh script )

Page 6
8 March 2021

IBM Support
Support case history
We need some data collection when the update is running. Capture the app handle of executing query. Create a script
data.ksh and ensure it has executable permission.
data.ksh:
#!/bin/ksh
DATE=`date +%Y-%m-%d.%H:%M:%S`
DIR=`pwd`
db2trc on -l 128m -apphdl $1 -member all
sleep 60
db2trc dump trc_$DATE.dmp -sdir $DIR -member all
db2trc off -member all
db2pd -d BLUDB -dump all dumpdir=$DIR apphdl=$1
db2 connect to BLUDB
db2 "select t.* from TABLE(MON_GET_EXTENDED_LATCH_WAIT(-2)) t ORDER BY MEMBER" >>
mon_get_extended_latch_wait_$DATE.out
db2 "select * from TABLE(MON_GET_CONNECTION(NULL,-2)) ORDER BY APPLICATION_HANDLE, MEMBER" >>
mon_get_connection_$DATE.out
db2 "select * from TABLE(MON_GET_ACTIVITY(NULL,-2)) ORDER BY APPLICATION_HANDLE, MEMBER" >>
mon_get_activity_$DATE.out
db2 connect reset
You can run the script as :- data.ksh <apphdl>
Please make sure it's run from a directory which is writable by all members. It would be worth getting 3-5 iterations of
running the script maybe 5 or 10 minutes apart, You can perform this task via user 'db2inst1'.
Thanks,
Aditya
03:45 PM Vietcombank IT Center (Customer)
Hello Aditya!

This problem was discovered since migrate data from netezza to IIAS machine half year ago.
Your experts have tried to solve this problem before, but not success. Then they proposed open the case for this issue
on IBM support.

With the next webex session you can able to get all data to diagnose the issue.
Please let me know, if the system downtime then how long does it take? because it's product system.
Thanks for your support!
Regards.

24 Nov 2020
01:38 PM Aditya.Mudholkar (IBM)
Hello Team,
For the update query slowness,
- We have studied the SQL plan and CDE trace and found the outstanding part is not something inefficient query plan or
a DB2 engine layer issue.
But the number of rows for update is just too many and time is taken due to that.

- We also got indirect evidence showing non update part of the query completes in a few minutes.

According to our experts, we need some more data to diagnose the issue.
If the purpose of WEBX is resolving the problem during the webex session, it would not help, as the time taken with
many rows update is expected.
Thanks,
Aditya

20 Nov 2020
08:32 AM Vietcombank IT Center (Customer)
Hi Aditya.Mudholka
We have to book webex slot with security department .
I may take 1 a week for preparing
I will open web slot at next Friday (27-Nov) and inform the time to start webex on 26-Nov

Page 7
8 March 2021

IBM Support
Support case history
Thanks&Regards

19 Nov 2020
12:44 PM Aditya.Mudholkar (IBM)
Hello Team,
Could you please confirm us the timing to schedule the Webx so that we can appoint our SME during that time.
Thanks,
Aditya
12:37 PM Aditya.Mudholkar (IBM)
Hello Team,
Please find my Webx link - https://ibm.webex.com/meet/aditya.mudholkar
Thanks,
Aditya
09:27 AM Vietcombank IT Center (Customer)
Hello Aditya!
Can you help to open webex for case?
We are anxious to knock off this issue!
Thanks&Regards.

17 Nov 2020
06:26 PM Aditya.Mudholkar (IBM)
Hello Team,
In continuation to the recent update, <apphdl> would be the APPLICATION_HANDLE of 'update' query.
./data.ksh <apphdl of update query>
Thanks,
Aditya
06:18 PM Aditya.Mudholkar (IBM)
Hello Team,
Per the .pdf file MobaXterm_10.1.27.11_20201117_151159.pdf, it seems that the script (data.ksh ) was run without an
argument (App. handle).
Errors reported in .pdf file -
Incorrect application handle, or too many arguments.
node0103-fab: db2trc on -l 128m ... completed rc=1
Incorrect application handle, or too many arguments.
node0102-fab: db2trc on -l 128m ... completed rc=1
It should be run by specifying application handle -> ./data.ksh <apphdl>
Moreover we want at least 3 - 5 iterations of the above script while the update is being run.
Thanks,
Aditya
05:31 PM Vietcombank IT Center (Customer)
Hi Aditya.Mudholkar

The data collection in attach files:

mon_get_extended_latch_wait_2020-11-17.15_07_06.out
mon_get_connection_2020-11-17.15_07_06.out
mon_get_activity_2020-11-17.15_07_06.out
MobaXterm_10.1.27.11_20201117_151159.rtf

Regards
01:25 PM Aditya.Mudholkar (IBM)
Hello Team,
May I have an update over the last post in this regard.
Thanks,
Aditya

12 Nov 2020
12:20 PM Aditya.Mudholkar (IBM)
Hello Team,

Page 8
8 March 2021

IBM Support
Support case history
The test result provides some pretty good (indirect) evidence that the bottleneck is very probably the update part of the
processing, the point of that test was to see how long the non-update part of the processing would take on its own, it
completed in a few minutes.
We need some data collection when the update is running. Capture the app handle of executing query. Create a script
data.ksh and ensure it has executable permission.
data.ksh:
#!/bin/ksh
DATE=`date +%Y-%m-%d.%H:%M:%S`
DIR=`pwd`
db2trc on -l 128m -apphdl $1 -member all
sleep 60
db2trc dump trc_$DATE.dmp -sdir $DIR -member all
db2trc off -member all
db2pd -d BLUDB -dump all dumpdir=$DIR apphdl=$1
db2 connect to BLUDB
db2 "select t.* from TABLE(MON_GET_EXTENDED_LATCH_WAIT(-2)) t ORDER BY MEMBER" >>
mon_get_extended_latch_wait_$DATE.out
db2 "select * from TABLE(MON_GET_CONNECTION(NULL,-2)) ORDER BY APPLICATION_HANDLE, MEMBER" >>
mon_get_connection_$DATE.out
db2 "select * from TABLE(MON_GET_ACTIVITY(NULL,-2)) ORDER BY APPLICATION_HANDLE, MEMBER" >>
mon_get_activity_$DATE.out
db2 connect reset
You can run the script as :- data.ksh <apphdl>
Please make sure it's run from a directory which is writable by all members. It would be worth getting a few iterations of
running the script maybe 5 or 10 minutes apart, You can perform this task via user 'db2inst1'.
Thanks,
Aditya

10 Nov 2020
11:47 AM Aditya.Mudholkar (IBM)
Hello Team,
Thanks for uploading the logs. Our experts has already started reviewing the latest uploaded logs.
I will get back to you as soon as I get an update from their end.
Thanks,
Aditya

9 Nov 2020
11:10 AM Vietcombank IT Center (Customer)
Hi ibm support team!
Please check attach file output_Check.txt
The result of command:
db2batch -d BLUDB -f Check.sql -i complete -iso CS -o p 5 o 5 r 0 -r output_Check.txt;

Thanks&Regards.

6 Nov 2020
03:24 PM Aditya.Mudholkar (IBM)
Hello Team,
You can run it via user db2inst1.
Thanks,
Aditya
02:40 PM Vietcombank IT Center (Customer)
hi IBM support!
What's user to run db2batch command? db2inst1 or bluadmin?

Thanks&Regards.
12:56 PM Aditya.Mudholkar (IBM)
Hello Team,
We want to check if that update is slow basically due to too many rows to update.
So we want to check how long the following select query takes and how many rows are injected to process the update.

Page 9
8 March 2021

IBM Support
Support case history
Please attempt the following steps in this regard: -
1. Save the below query in a file.
SELECT A.MATAPHOP,B.MAKHACHHANG
FROM
NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX A,
(SELECT
*
FROM
NZ_VCB_PAR.FTP_TAPHOPGL_GIAODICH_FIX
WHERE
ISDELETED = 'N'
)B
WHERE
A.GLACCT <> 0 AND
STRLEFT(A.GLACCT, LENGTH(TRIM(B.SOTAIKHOAN))) = B.SOTAIKHOAN;
2.Run db2batch : "r 0" option avoids displaying rows in the session to eliminate the time for that. ( Specify the above file
name in -f option)
db2batch -d BLUDB -f <sql_file> -i complete -iso CS -o p 5 o 5 r 0 -r <output_file>
Thanks,
Aditya

5 Nov 2020
02:51 PM Aditya.Mudholkar (IBM)
Hi Team,
Apologies for the delay. Our internal teams are still working to investigate this issue.
We will get back to you with a root cause of query slowness as soon as we get an update.
Thanks,
Aditya
02:30 PM Vietcombank IT Center (Customer)
Hi support team!

Are you working?


I haven't heard from anything for a long time...
Please help to check this case!

Thanks&Regards.

29 Oct 2020
12:57 PM Vietcombank IT Center (Customer)
Dear IBM support!
Yes it is. That is very slow, and almost the update query is slow
It got indeed 90 minutes on yesterday afternoon
Yesterday, I run the query from 1:45pm to 3:15pm then it finished.
Please help to check this issue!
Thanks
12:42 PM Aditya.Mudholkar (IBM)
Hello Team,
Based on the CDE trace analysis, it has been concluded that the update statement took 911 seconds only which is
about 15 minutes.
Is this still slow ?
Could you please explain the difference of elapsed time if it took indeed 100 minutes ?
Thanks,
Aditya
12:29 PM Vietcombank IT Center (Customer)
Dear IBM support!
Yess. Update query is still slow, it took indeed 100 minutes! from 1:45pm to 3:15pm.

12:12 PM Nilesh.Patil (IBM)


Hi Team,

Page 10
8 March 2021

IBM Support
Support case history
From the CDE trace, query took 911 seconds only which is about 15 minutes.
Can you please confirm update query is still slow?
Can you please explain the difference of elapsed time if it took indeed 100 minutes ?

Regards,
Nilesh

28 Oct 2020
04:17 PM Vietcombank IT Center (Customer)
hello!
Please check attach file 20201028.rar:
The steps save as session_1, session_2.
This is the result of your command that you provide to to take CDE trace.

Please help to check.


Thanks
Regards

27 Oct 2020
10:24 AM Nilesh.Patil (IBM)
Hi Team,

Did you get a chance to take CDE trace ?

Regards,
Nilesh

26 Oct 2020
08:42 AM Vietcombank IT Center (Customer)
hi Aditya, Nilesh
Administrator team is working
I will send the result for you when i receive the new information from Administrator team!

Thanks for your support!


Regards

24 Oct 2020
07:24 PM Aditya.Mudholkar (IBM)
Hello Team,
Could you please update if you got a chance to generate the CDE performance trace, by following up the steps
shared by Nilesh in the last update.
Thanks,
Aditya

23 Oct 2020
09:33 AM Nilesh.Patil (IBM)
Hi Team,

We did not find to much information from uploaded diagnostic. so for further investigation we need CDE trace.

Here is the steps :

To take CDE per trace , we need two session opened from db2inst1.

step 1(session1)-->db2 connect to BLUDB


- get the apphandle for the connection with the following query (from the same session)

Page 11
8 March 2021

IBM Support
Support case history
select application_handle, application_name, application_id, member, rows_read
from table(sysproc.mon_get_connection(sysproc.mon_get_application_handle(), -1))
as conn
step 2 (session2):Using db2inst1
db2trc on -l 512m -m CDE_PERF_TRACE -apphdl <application_handle_id> -member all (--> you will
Step3(session1)- run the query.
-Once query is completed,we can dump trace from db2inst1 session with:
step4(session2)db2trc dump trc.dmp -sdir /scratch -member all ;
step5(session2) db2trc off -member all

step6(session2) format the dump files.


go to the scratch
for fname in `ls trc.dmp_*`
do
db2trc flw $fname $fname.flw -t
db2trc fmt $fname $fname.fmt
done
upload the files all files to the ecurep.

Please let me know if you need any help.


08:15 AM Vietcombank IT Center (Customer)
Hi Aditya!
I will attatch the result in IIAS_FTP_LAISUAT_NGAY_Query.xlsx file.

Thanks.
Regards

22 Oct 2020
08:22 PM Aditya.Mudholkar (IBM)
Hello Team,
Thanks for uploading the logs. We have engaged our query experts in this issue. We'll get back to you as soon as
we get an update from them.
Mean while could please upload the following queries output.
db2 "SELECT colname, colcard FROM syscat.columns WHERE tabname='FTP_LAISUAT_NGAY_ALL_TMP_FIX' AND
tabschema = 'NZ_VCB_RPT' ORDER BY colcard desc with ur"
db2 "SELECT DBPARTITIONNUM(GLACC)Partition, COUNT(*)Total_Rows FROM
NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX group by DBPARTITIONNUM(GLACC) order by
DBPARTITIONNUM(GLACC)"
db2 "SELECT DBPARTITIONNUM(BRN)Partition, COUNT(*)Total_Rows FROM
NZ_VCB_RPT.FTP_LAISUAT_NGAY_ALL_TMP_FIX group by DBPARTITIONNUM(BRN) order by
DBPARTITIONNUM(BRN)"
Thanks,
Aditya
05:36 PM Vietcombank IT Center (Customer)
Dear Nilesh!
I uploaded that db2support_cl2.zip folder
Please help to check .
Thanks.
02:59 PM Nilesh.Patil (IBM)
Hi Team,

Thanks.
Please upload the db2support. we need all files. please upload that zip folder.

We will review the logs and get back to you.

Regards,
Nilesh
02:13 PM Vietcombank IT Center (Customer)
Dear Nilesh!
db2support command done!
db2support_cl2.zip file is very big,

Page 12
8 March 2021

IBM Support
Support case history
Can you select files are really necessary that supports for issue analysis?
autopdzip
DB2CONFIG
DB2DUMP
DB2MISC
DB2SNAP
STMM
TSA
db2supp_opt.zip
db2supp_system.zip
db2support.err
db2support.html
db2support.log
db2support.map
db2support_options.in
I will attatch files that you requested.

Thanks for your support!


Regards/
01:55 PM Nilesh.Patil (IBM)
Hi Team,

Let's have a quick discussion over WebEx.


https://ibm.webex.com/join/nilesh.patil

Thanks,
Nilesh
01:46 PM Vietcombank IT Center (Customer)
Dear Nilesh
For db2support.
db2support /scratch -s -d bludb -localhost -cl 1 -sf bad.sql -o db2support_cl2.zip
The result is still the same:
sh: samversion: command not found
sh: lssrc: command not found
Error: Invalid directory "/head/home/db2inst1/sqllib/db2support_85664_1602660391_tmp" for -member or -host option.

Please help to check


Thanks.

01:15 PM Nilesh.Patil (IBM)


Hi Team,

Thanks for your update.


Yes. I see the we are having correct results of db2exfmt.

For db2support.

db2support /scratch -s -d bludb -localhost -cl 1 -sf <query> -o db2support_cl2.zip

Please let me know if you still having any issue.

Regards,
Nilesh
11:30 AM Vietcombank IT Center (Customer)
Dear Nilesh!
db2 set current explain mode EXPLAIN
db2 <"RUN THE QUERY">
db2exfmt -d <dbname> -g TIC -w -1 -n % -s % -# 0 -o db2exfmt_bad.out
---> Return: Please help to check file attached db2exfmt_bad.zip.

db2 set current explain mode no


db2support /scratch -d bludb -s -cl 0 -o db2support.zip
-->Return: the result is still the same:

Page 13
8 March 2021

IBM Support
Support case history
sh: samversion: command not found
sh: lssrc: command not found
Error: Invalid directory "/head/home/db2inst1/sqllib/db2support_85664_1602660391_tmp" for -member or -host option.

Please help to check.

Thanks for your support!


Regards.

08:01 AM Nilesh.Patil (IBM)


Hi Team,

I could see explain tables are ORGANIZE BY ROW in our test system where DFT_TABLE_ORG=COLUMN.
Can you please just drop and recreate the EXPLAIN TABLES.
You can make use of below procedure to recreate the EXPLAIN tables.

To drop the explain tables


CALL SYSPROC.SYSINSTALLOBJECTS('EXPLAIN', 'D', CAST (NULL AS VARCHAR(128)), CAST(NULL AS
VARCHAR(128)) )
then create the explain tables
CALL SYSPROC.SYSINSTALLOBJECTS('EXPLAIN', 'C', CAST (NULL AS VARCHAR(128)), CAST(NULL AS
VARCHAR(128)) )

https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.explain.doc/doc/t0059594.html

Thanks,
Nilesh

21 Oct 2020
04:25 PM Vietcombank IT Center (Customer)
Dear Nilesh!
BLUADMIN.EXPLAIN_INSTANCE table has table type is ORGANIZE BY COLUMN???
Regards/
04:00 PM Vietcombank IT Center (Customer)
Hi Nilesh.
Explain tables exist in bluadmin schema:
[bluadmin@node0101-fab - Db2wh ~]$ db2look -d bludb -e -i bluadmin -w bluadmin -t
BLUADMIN.EXPLAIN_INSTANCE;
-- No userid was specified, db2look tries to use Environment variable USER
-- USER is: BLUADMIN
-- The db2look utility will consider only the specified tables
-- Creating DDL for table(s)
-- This CLP file was created using DB2LOOK Version "11.1"
-- Timestamp: Wed 21 Oct 2020 10:50:25 AM +07
-- Database Name: BLUDB
-- Database Manager Version: DB2/LINUXPPC64LE Version 11.5.3.0
-- Database Codepage: 1208
-- Database Collating Sequence is: IDENTITY
-- Alternate collating sequence(alt_collate): null
-- varchar2 compatibility(varchar2_compat): OFF
CONNECT TO BLUDB USER bluadmin;
------------------------------------------------
-- DDL Statements for Table "BLUADMIN"."EXPLAIN_INSTANCE"
------------------------------------------------
CREATE TABLE "BLUADMIN"."EXPLAIN_INSTANCE" (
"EXPLAIN_REQUESTER" VARCHAR(128 OCTETS) NOT NULL ,
"EXPLAIN_TIME" TIMESTAMP NOT NULL ,
"SOURCE_NAME" VARCHAR(128 OCTETS) NOT NULL ,
"SOURCE_SCHEMA" VARCHAR(128 OCTETS) NOT NULL ,
"SOURCE_VERSION" VARCHAR(64 OCTETS) NOT NULL ,

Page 14
8 March 2021

IBM Support
Support case history
"EXPLAIN_OPTION" CHAR(1 OCTETS) NOT NULL ,
"SNAPSHOT_TAKEN" CHAR(1 OCTETS) NOT NULL ,
"DB2_VERSION" CHAR(7 OCTETS) NOT NULL ,
"SQL_TYPE" CHAR(1 OCTETS) NOT NULL ,
"QUERYOPT" INTEGER NOT NULL ,
"BLOCK" CHAR(1 OCTETS) NOT NULL ,
"ISOLATION" CHAR(2 OCTETS) NOT NULL ,
"BUFFPAGE" INTEGER NOT NULL ,
"AVG_APPLS" INTEGER NOT NULL ,
"SORTHEAP" INTEGER NOT NULL ,
"LOCKLIST" INTEGER NOT NULL ,
"MAXLOCKS" SMALLINT NOT NULL ,
"LOCKS_AVAIL" INTEGER NOT NULL ,
"CPU_SPEED" DOUBLE NOT NULL ,
"REMARKS" VARCHAR(254 OCTETS) ,
"DBHEAP" INTEGER NOT NULL ,
"COMM_SPEED" DOUBLE NOT NULL ,
"PARALLELISM" CHAR(2 OCTETS) NOT NULL ,
"DATAJOINER" CHAR(1 OCTETS) NOT NULL ,
"EXECUTABLE_ID" VARCHAR(32 OCTETS) FOR BIT DATA ,
"EXECUTION_TIME" TIMESTAMP )
DISTRIBUTE BY HASH("EXPLAIN_REQUESTER",
"EXPLAIN_TIME",
"SOURCE_NAME",
"SOURCE_SCHEMA",
"SOURCE_VERSION")
IN "TESTUPDATE"
ORGANIZE BY COLUMN;
-- DDL Statements for Primary Key on Table "BLUADMIN"."EXPLAIN_INSTANCE"
ALTER TABLE "BLUADMIN"."EXPLAIN_INSTANCE"
ADD PRIMARY KEY
("EXPLAIN_REQUESTER",
"EXPLAIN_TIME",
"SOURCE_NAME",
"SOURCE_SCHEMA",
"SOURCE_VERSION")
NOT ENFORCED;
COMMIT WORK;
CONNECT RESET;
TERMINATE;

Can drop and recreate the explain tables?


Thanks
Regards.

03:04 PM Nilesh.Patil (IBM)


Hi Team,

Thanks for your update.


Ok. Then try to drop and recreate the explain tables.
Please follow the below KC document.
https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.explain.doc/doc/t0059594.html

Please use db2inst1 userid to perform all the steps.

Let me know if you need any help.


02:21 PM Vietcombank IT Center (Customer)
Hi Nilesh
What's proper schema in this case? BLUADMIN or schema of the table in the query?
if i set proper schema is BLUADMIN, The result is still the same

Please check 20201021_error_DB21034.png file.

Page 15
8 March 2021

IBM Support
Support case history
Thanks
Regards
01:26 PM Nilesh.Patil (IBM)
Hi Team,

Can you please run this query from db2inst1 user also you can run the same query from bluadmin id by setting proper
schema.

db2 connect to bludb


db2 set schema <schema name>

db2 set current explain mode EXPLAIN


db2 <"RUN THE QUERY">
db2exfmt -d <dbname> -g TIC -w -1 -n % -s % -# 0 -o db2exfmt_bad.out
db2 set current explain mode no
db2support /scratch -d bludb -s -cl 0 -o db2support.zip

-------------------------------------------------------------------------------------------------------------------------

if this will not worked then drop the and recreate the explain tables.

Please follow the below KC.


https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.explain.doc/doc/t0059594.html

Hope this will help you.

Thanks,
Nilesh

11:12 AM Vietcombank IT Center (Customer)


Dear supporter!
i get an error when run command
db2 set current explain mode EXPLAIN
db2 <"RUN THE QUERY">
DB21034 The command was processed as an SQL statement because it was not a vaild command Line Processor
command. During SQL processing it returnes:
SQL1667N The operation failed because the operation is not supported with the type of the
specified table. Specified table: "BLUADMIN.EXPLAIN_INSTANCE". Table type: "ORGANIZE BY COLUMN".
Operation: "EXPLAIN". SQLSTATE=42858.
Please help to check file attached.

Thanks and Regards/

20 Oct 2020
02:38 PM Nilesh.Patil (IBM)
Hi Team,

Here are the steps to gather the db2explain.


db2 set current explain mode EXPLAIN
db2 <"RUN THE QUERY">
db2exfmt -d <dbname> -g TIC -w -1 -n % -s % -# 0 -o db2exfmt_bad.out
db2 set current explain mode no
db2support /scratch -d bludb -s -cl 0 -o db2support.zip

Please upload the db2exfmt_bad.out and db2support.zip file for further investigation.

01:33 PM Vietcombank IT Center (Customer)

Page 16

You might also like