would using current of cursor improve performance ?

I have a long running program that does a simple thing: reads records from Table A (staging) and loads them to the similarly structured Table B (Production).

I'm looking at all ways to improve performance.

After reading and loading 1 record to Table B-Prod, the corresponding record is updated to reflect "loaded".

the update statement updates based on the primary key (claim_seqno).

Would there be any potential performance improvement by using "current of cursor" ?

Currently it's:
UPDATE ODS.MEM_MEMB_SUB_GRP SET ODS_STUS_CD = 'L'
WHERE
 MEMB_SUB_GRP_SEQNO = 123456

So I would make it
UPDATE ODS.MEM_MEMB_SUB_GRP SET ODS_STUS_CD = 'L'
WHERE current of cursor

. . . and I think I have to make the query "for update"
- I assume this locks the table from updates

LVL 1
Alaska CowboyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
sdstuberConnect With a Mentor Commented:
the "for update" clause will cause the rows to be locked

"where current of" should be faster since it doesn't need to requery the table, it already knows where there row is.

faster yet, if possible, write your update as a single statement rather than iterating through all the rows procedurally.
0
 
Alaska CowboyAuthor Commented:
ok, thanks.
yes, it's possible I can make one big update statement instead of 1 at a time, good idea.
0
 
Alaska CowboyAuthor Commented:
helps my analysis that I need to present next week.
0
All Courses

From novice to tech pro — start learning today.