Hi All,
I was trying to update DB2 table update using PROC SQL pass through facility. I had a temporary table whose data i needed to refer to update my table. Now when the rows in temp table were like 40-60 rows with the indexed primary key ( ppt in our case) , the updation went perfectly fine and within less than 2 CPU minute the updations were in place. But when the data on the temp table increased to 2000+ rows with the indexed primary key ( ppt in our case) started taking more than normal time. As i was working on mainframes so TIME=30 caused my job to abend because of time out (SEC6). When I asked one of my seniors in the office, he said i need to restructure my query as my query is not that efficient and hence was taking longer than usual time. Below is what my code looked like.
update &database..updating_table a
set var='newvalue'
where a.ppt exists ( select 1 from mytemp.table x
where x.ppt=a.ppt
and x.var=a.var
and x.somecondition=a.somecondition
)
I tried restructuring the code ( had no clue what to restructue, i think i was probably not convinced or understood what difference it would make), eventually did got his help to restructure the sql , but the code still did not work with TIME=30. As the restructuring didn't help so i took my original code and increased the time to a good number. The update did got completed but with increased time. The project is over, but I still don't understand and have this question still lingering in my head, if restructuring the above sql could decrease the time. and is the above code really inefficient and if it is then what should be the code like for such case.
Thanks!
... View more