My application has 4 different threads doing inserts into the same DB2 table simultaneously.
Could this cause a deadlock / lockwait situtation?
Theoretically I don't see a problem here; as one insert statement is not going to lock a row required by another insert statement because all are independent insert statements.
Also, I commit after each insert so transaction log wouldn't fill up.
I'm looking for a high performance model while avoiding any potential lock situtation. Please provide your thoughts.
Best Answer
I don't see a problem either.
If your application logic allows, you might consider committing every N rows.
For improved performance, you might consider whether you can do blocked inserts of multiple rows at a time.
(I use DB2 for i. If you are on LUW or z/OS, your mileage may vary.)