Duran's technical life
          踏踏實實學技術,認認真真做研究。

          @title [筆記]事務處理

          #1 Transaction Propagation Behavior
          Required:Excute within a current tx, create a new one if none exists.
          Supports: Excute within a current tx, execute without a tx if none exsits.
          Mandatory: Excute within a current tx, throw an exception if none exists.
          Requires New: Create a new tx and excute within the tx, suspend the current tx if one exists.
          Not Supported: Excute without a tx, suspend the current tx if none exsits.
          Never: Excute without a tx, throw an exception if a tx exsits.

          #2 Transaction Isolation Level[1]
          #2.1 Concurrent Problem
          Dirty Reads: 臟讀(臟數據指已更新,還沒提交的數據)。事務T1讀取到事務T2中的臟數據。

          Unrepeatable Reads: 不可重復讀。事務T1檢索到某行后,事務T2更新并提交了該行,若事務T2再次檢索該行,則會看到不一樣的結果。

          Phantom Reads: 虛讀。事務T1檢索到符合某條件的行集后,事務T2插入并提交了滿足該條件的新行,若事務T2再次按該條件檢索,則會看到以前不存在的行“Phantom”。

          #2.2 Isolation Level
          +---------------+-------+------------------+-----------+
          |Isolation Level|Phantom|Unrepeatable Reads|Dirty Reads|
          +---------------+-------+------------------+-----------+
          |Read Uncommited|   Y   |         Y        |     Y     |
          +---------------+-------+------------------+-----------+
          |Read Commited  |   Y   |         Y        |     N     |
          +---------------+-------+------------------+-----------+
          |Repeatable Read|   Y   |         N        |     N     |
          +---------------+-------+------------------+-----------+
          |Serializable   |   N   |         N        |     N     |
          +---------------+-------+------------------+-----------+

          #3 Timeout

          #4 ReadOnly Transaction
          只讀事務保證了多條查詢SQL的在事務級別的讀一致性。JDBC和數據庫會對只讀事務做一些優化。

          [1] C.J.Date, An Introduction to Database Systems 7th.

          posted on 2005-09-09 13:09 Duran's technical life 閱讀(722) 評論(1)  編輯  收藏 所屬分類: 技術積累
          Comments
           
          主站蜘蛛池模板: 开江县| 萍乡市| 达日县| 南昌县| 孟连| 陇南市| 常熟市| 喀喇| 湖州市| 拉萨市| 原平市| 涡阳县| 弥渡县| 德令哈市| 新兴县| 建水县| 泾阳县| 宣汉县| 阿坝县| 沂水县| 宁津县| 杭锦旗| 武川县| 买车| 五指山市| 宣恩县| 兴安盟| 平塘县| 菏泽市| 甘谷县| 正定县| 萍乡市| 凤翔县| 青阳县| 雷州市| 施甸县| 临潭县| 灵丘县| 嵊泗县| 邓州市| 余干县|