根据TOM的建议,事务应该尽量长,而不是尽量短。这和3楼的说明是一致的,即所有的插入操作完成后只提交一次。 下面引自Tom的Expert Oracle Database Architecture: 9i and 10g Programming Techniques and Solutions Chapter 8 Transactions Bad Transaction Habits节Oracle takes the opposite approach. Transactions are always implicit, and there is no way to have an “autocommit” unless an application implements it (see the “Using Autocommit” section for more details). In Oracle, every transaction should be committed when it must and never before. Transactions should be as large as they need to be. Issues such as locks, blocking, and so on should not really be considered the driving forces behind transaction size—data integrity is the driving force behind the size of your transaction. Locks are not a scarce resource, and there are no contention issues between concurrent readers and writers of data. This allows you to have robust transactions in the database. These transactions do not have to be short in duration—they should be exactly as long as they need to be (but no longer). Transactions are not for the convenience of the computer and its software; they are to protect your data.
具体怎么样好看有高手知道不
关注
下面引自Tom的Expert Oracle Database Architecture: 9i and 10g Programming Techniques and Solutions
Chapter 8 Transactions
Bad Transaction Habits节Oracle takes the opposite approach. Transactions are always implicit, and there is no way
to have an “autocommit” unless an application implements it (see the “Using Autocommit”
section for more details). In Oracle, every transaction should be committed when it must and
never before. Transactions should be as large as they need to be. Issues such as locks, blocking,
and so on should not really be considered the driving forces behind transaction size—data
integrity is the driving force behind the size of your transaction. Locks are not a scarce
resource, and there are no contention issues between concurrent readers and writers of data.
This allows you to have robust transactions in the database. These transactions do not have
to be short in duration—they should be exactly as long as they need to be (but no longer).
Transactions are not for the convenience of the computer and its software; they are to protect
your data.