AUTONOMOUS_TRANSACTION [英] AUTONOMOUS_TRANSACTION

查看:52
本文介绍了AUTONOMOUS_TRANSACTION的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑使用 AUTONOMOUS_TRANSACTION语法进行批处理过程中的某些登录.有人对这个有经验么 ?如果是这样,任何利弊将不胜感激.

I was thinking of using AUTONOMOUS_TRANSACTION Pragma for some logging in a batch process. Does anyone have any experience with this ? If so any pros and cons would be appreciated.

推荐答案

IMO自主事务特别适用于日志记录:它们独立于主会话运行,这意味着您可以在表中编写,提交或回滚更改,而不会影响主记录.交易.

IMO Autonomous Transactions are particularly adapted to logging: they run independently from the main session, meaning you can write in a table, commit or rollback changes without affecting the main transaction.

它们还增加了很少的开销:如果您运行大型语句并在每个语句之间添加自主事务,则性能成本可以忽略不计.

They also add little overhead: if you run big statements and add an autonomous transaction between each statement the performance cost will be negligible.

还有一个副作用,您可能会发现它很有趣:由于自主事务与调用事务处于独立的会话中,因此您可以在主进程运行时跟踪其进程.您不必等待主事务完成:您可以查询日志表,因为它由自主事务填充.

There is also a side-effect that you may find interesting: since the autonomous transactions are in independant sessions from the calling transaction, you can follow the progression of your main process as it is running. You don't have to wait for the main transaction to finish: you can query the logging table as it is filled by the autonomous transactions.

这篇关于AUTONOMOUS_TRANSACTION的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆