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
           
          主站蜘蛛池模板: 甘德县| 含山县| 开远市| 常德市| 洪江市| 海林市| 安宁市| 玉屏| 灌云县| 渭源县| 齐齐哈尔市| 玛曲县| 花莲市| 河北区| 乌鲁木齐市| 驻马店市| 中西区| 错那县| 贵南县| 连州市| 陆良县| 舒城县| 霍城县| 潞西市| 宁德市| 永宁县| 武汉市| 西乌| 彭泽县| 萨嘎县| 大港区| 蒙城县| 宜章县| 措勤县| 南宫市| 新绛县| 新干县| 章丘市| 大冶市| 德安县| 浮梁县|