最近在看一本书,《Oracle Core: Essential Internals for DBAs and Developers》 ,真是好书。
里面知识点太多,要是看完一切记下,估计会遗漏一些。
那就边看边记。
事务回滚的时候,很多步骤要执行,所以比较消耗资源。要是用插入数据不提交来实现临时功能,就不合适了。
下面是原文,比翻译过来贴切一些。
Rolling back involves a lot of work, and a rollback can take roughly the same amount of time as the original transaction, possibly generating a similar amount of redo.
But you have to remember that rolling back is an activity that changes data blocks, so you have to reacquire, modify, and write those blocks, and write the redo that describes how you’ve changed those blocks. Moreover, if the transaction was a large, long-
running transaction, you may find that some of the blocks you’ve changed have been written to disc and flushed from the cache —so th ey’ll have to be read from disc before you can roll them back!
Note Some systems use Oracle tables to hold “temporary” or “scratchpad”
information. One of the strategies used with such tables is to insert data without
committing it so that read consistency makes it private to the session, and then roll back
to make the data “go away.” There are many flaws in this strategy, the potentially high
cost of rolling back being just one of them. The ability to eliminate the cost of rollback is
one of the things that makes global temporary tables useful.