Quote:
|
Originally Posted by stephen.song
why are you keeping your table locked unless rest of the 5 inserts are done ?
I think there`s just a row lock in your table after insert and before commit.
|
On INSERTs, DB2 has to keep the X-locks until the end of the transaction to prevent dirty reads. Due to lock hierarchies, you will also have an IX-loxk at the table level. Hierarchical locks are needed for table or system-wide operations, e.g. for a DROP TABLE command, you do not want to X-lock every single row in the table, but just the table itself. But when you do that, you need some information at the table level whether there are locks set on a level further down, i.e. on pages or rows associated with the table.
Whether you have row, page, or table level locks depends on your configuration, isolation level setting and whether lock escalation occurs. So you cannot necessarily assume to have "just a row lock".