空调外机为什么会滴水| 辰砂是什么| 腹胀腹痛吃什么药| 什么杀精子最厉害| 眼压高是什么原因| 为什么现在不建议输液| 25岁今年属什么生肖| 芹菜炒什么配菜好吃| 近亲是什么意思| 割包皮有什么好处| 唐僧姓什么| 一什么千什么| 箱涵是什么| 梦见栽花是什么意思| 伯爵是什么意思| 更年期失眠吃什么药| 颈椎压迫神经吃什么药| 塞肛门的止痛药叫什么| 女人小腹坠痛是什么原因| 老人经常头晕是什么原因引起的| hr过高是什么意思| 天河水是什么意思| 7月份是什么季节| 情人是什么意思| 什么钙片好| 鼻子经常出血是什么病征兆| 手麻挂什么科最好| 咳喘是什么原因| 吃什么可以缓解焦虑| 尿毒症是什么引起的| 九月初四是什么星座| 维生素c十一什么意思| 头孢是治疗什么病的| 臊子面的臊子是什么| chemical是什么意思| 荷叶有什么功效和作用| 什么情况下做冠脉ct| 发动机抖动是什么原因| 皮肤属于什么组织| 笄礼是什么意思| 社保卡是什么意思| 更年期燥热吃什么食物| 宫颈纳囊是什么| 什么是流程| 彩字五行属什么| 5月24号是什么日子| 枇杷是什么季节的水果| 向日葵代表什么象征意义| 手掌发麻是什么原因| 所不欲勿施于人是什么意思| 吃大枣有什么好处| 臻字五行属什么的| 回苏灵又叫什么| 工作坊是什么意思| 经常头疼什么原因| 刚怀孕需要注意什么| 复辟什么意思| 归脾丸治什么病| 缺黄体酮会有什么症状| 发烧喝什么饮料比较好| 偏旁和部首有什么区别| 小白兔是什么意思| 皮下脂肪瘤挂什么科| 脾大是什么原因造成的怎么治疗| 老是口干舌燥是什么原因| 儿童结膜炎用什么眼药水| 脸热发红是什么原因| 盐糖水有什么功效作用| 胎儿左心室强光点是什么意思| 胆汁酸高是什么意思| 黄疸挂什么科| 青霉素是什么药| 肺结核有什么症状| 眼震是什么症状| 摧枯拉朽什么意思| 女人依赖男人说明什么| 白细胞数目偏高是什么意思| 舌根发麻是什么原因| 肠胃炎适合吃什么食物| 车前草有什么功效和作用| 梦见发工资了是什么意思| 游泳是什么运动| 15岁属什么| 头发白是什么原因引起的| 左舌根疼痛是什么情况| 爽文是什么意思| 沈阳是什么省| 手指麻木是什么原因| 什么是心衰病| 老虎下山下一句是什么| 经血颜色淡是什么原因| levis是什么牌子| EV71疫苗是什么| 喜欢闻汽油味是什么原因| titus手表属于什么档次| 排卵期为什么会出血| 肚子腹泻是什么原因| 刺激性干咳是什么症状| #NAME?| 火可念什么| 什么大专好就业| 喇叭裤配什么上衣| 马路上的菱形标志是什么意思| 补蛋白吃什么最好| 频繁做噩梦是什么原因| 格林巴利综合症是什么病| 敏是什么意思| 语什么心什么| 孕期长痘痘是什么原因| 肩膀疼挂什么科室最好| 整个后背疼是什么原因| 排骨炖什么菜好吃| 滴虫长什么样子图片| 命硬的人有什么特征| 心率过低吃什么药| 老公的弟弟叫什么| 1月17日是什么星座| 月经咖啡色是什么原因| 脚底干裂起硬皮是什么原因怎么治| 溃疡性结肠炎有什么症状| 备注是什么意思| 爱居兔女装是什么档次| 什么是外阴炎| 杏仁是什么树的果实| 10月27日什么星座| 血糖高是什么原因造成的| 煜字五行属什么| 中超是什么| mect是什么意思| 接吻要注意什么| 属龙女和什么属相最配| 什么人容易长智齿| 打飞机是什么意思| egfr医学上是什么意思| 为什么会心悸| 胎儿靠什么吸收营养| 女性虚火旺吃什么下火| 肚子里面跳动是什么原因| 梦遗是什么意思| 信子是什么意思| 牛皮癣是什么| 维生素c不能和什么一起吃| 小孩下半夜咳嗽是什么原因| 心肌炎做什么检查| 胆固醇高应注意什么| 尘肺病吃什么能排出尘| 换床有什么讲究| 什么动听四字词语| 头疼发热是什么原因| 今天美国什么节日| 麦冬长什么样| 碘是什么东西| 整编师和师有什么区别| 好吃懒做的动物是什么生肖| 病毒性感染是什么原因引起的| 喝醋对身体有什么好处| 五味子有什么功效| 11月9日是什么日子| 什么什么不惧| 鼻窦炎吃什么药| omega3是什么| 怀孕初期流产有什么症状| 月经前一周失眠是什么原因| 梦见胡萝卜是什么意思| 中暑喝什么药| 挂号是什么意思| 陈皮是什么皮| 心慌挂什么科| 天时地利人和是什么意思| 人的胆量由什么决定| 云仓是什么| 姑姐是什么意思| 睡觉出汗是什么原因男性| 临字五行属什么| 晚上左眼皮跳预示什么| 高血压突然变成低血压是什么原因| 武汉都有什么区| 行号是什么| 什么病不能坐飞机| 居里夫人发明了什么| 梦见蛇吃人代表什么预兆| lz什么意思| 腰椎间盘突吃什么药| 疱疹不能吃什么| 痛风吃什么中药最有效| 荨麻疹是由什么引起的| 辣椒炒什么好吃| 狗到家里是什么预兆| 肾的作用和功能是什么| 石斛配什么泡水喝好| 炖羊肉放什么调料| 肾阴虚吃什么中成药| pagani是什么车| 梅干菜是什么菜做的| 乳腺疼挂什么科| 恳请是什么意思| 儿童缺铁吃什么补得快| 聚酯纤维是什么面料| 苹果枸杞红枣煮水喝有什么功效| 梦见偷鸡是什么预兆| 16周检查什么项目| 耕的左边读什么| 低血糖吃什么好| 牛肉馅饺子配什么菜| 增强胃动力吃什么药| 21是什么意思| 胃疼吃什么水果| 做梦梦见死去的亲人是什么意思| 牛肚是牛的什么部位| 疝气是什么病| 感冒有什么症状| 气管炎吃什么食物好| 利可君片是治什么病| 左胳膊发麻是什么原因| 淋巴细胞偏低是什么意思| 金光是什么生肖| 西瓜适合什么土壤种植| 范思哲香水是什么档次| 一阵一阵的胃疼是什么原因| 火乐念什么| 辅食是什么意思| 朱元璋为什么不杀汤和| 呼吸道感染一般用什么消炎药| 早上起床腰酸痛是什么原因| 倒班是什么意思| 口蘑不能和什么一起吃| 麻油跟香油什么区别| 尿酸高会引起什么疾病| 老年人出现幻觉是什么原因| 中央候补委员什么级别| 奔富红酒属于什么档次| 癫狂是什么意思| 一直呕吐是什么原因| 夏天为什么不能喝红茶| 吃什么长胖| ag医学上是什么意思| 氯雷他定片什么时候吃| 17号来月经什么时候是排卵期| 漫谈是什么意思| 次月是什么意思| 核糖体由什么组成| 脚心烧是什么原因| 什么虫子咬了会起水泡| 老鼠爱吃什么食物| 塔罗是什么意思| 一月六号是什么星座| 吃了安宫牛黄丸要禁忌什么不能吃| 月光族是什么意思啊| 哈怂是什么意思| 妇科凝胶排出的是什么| 南瓜与什么食物相克| 心电图p是什么意思| 胎位roa是什么意思| 38年属什么生肖| 宝宝什么时候长牙| colorful是什么牌子| bobby什么意思| 腰肌劳损用什么药最好| 梦见自己大肚子怀孕是什么意思| 母亲节送妈妈什么| 英特纳雄耐尔是什么意思| 婚检能检查出什么| 相是什么生肖| 身体痒是什么原因| 百度

河北乐亭:甜瓜飘香富农家

(Redirected from ACID (computer science))
百度   行政机构应当使用行政编制,不得混用、挤占、挪用或者自行设定其他类别的编制;不得将行政职能转由事业单位承担,不得批准设立承担行政职能的事业单位和从事生产经营活动的事业单位。

In computer science, ACID (atomicity, consistency, isolation, durability) is a set of properties of database transactions intended to guarantee data validity despite errors, power failures, and other mishaps. In the context of databases, a sequence of database operations that satisfies the ACID properties (which can be perceived as a single logical operation on the data) is called a transaction. For example, a transfer of funds from one bank account to another, even involving multiple changes such as debiting one account and crediting another, is a single transaction.

In 1983,[1] Andreas Reuter and Theo H?rder coined the acronym ACID, building on earlier work by Jim Gray[2] who named atomicity, consistency, and durability, but not isolation, when characterizing the transaction concept. These four properties are the major guarantees of the transaction paradigm, which has influenced many aspects of development in database systems.

According to Gray and Reuter, the IBM Information Management System supported ACID transactions as early as 1973 (although the acronym was created later).[3]

BASE stands for basically available, soft state, and eventually consistent: the acronym highlights that BASE is opposite of ACID, like their chemical equivalents.[4] ACID databases prioritize consistency over availability — the whole transaction fails if an error occurs in any step within the transaction; in contrast, BASE databases prioritize availability over consistency: instead of failing the transaction, users can access inconsistent data temporarily: data consistency is achieved, but not immediately.[5]

Characteristics

edit

The characteristics of these four properties as defined by Reuter and H?rder are as follows:

Atomicity

edit

Transactions are often composed of multiple statements. Atomicity guarantees that each transaction is treated as a single "unit", which either succeeds completely or fails completely: if any of the statements constituting a transaction fails to complete, the entire transaction fails and the database is left unchanged. An atomic system must guarantee atomicity in each and every situation, including power failures, errors, and crashes.[6] A guarantee of atomicity prevents updates to the database from occurring only partially, which can cause greater problems than rejecting the whole series outright. As a consequence, the transaction cannot be observed to be in progress by another database client. At one moment in time, it has not yet happened, and at the next, it has already occurred in whole (or nothing happened if the transaction was cancelled in progress).

Consistency

edit

Consistency ensures that a transaction can only bring the database from one consistent state to another, preserving database invariants: any data written to the database must be valid according to all defined rules, including constraints, cascades, triggers, and any combination thereof. This prevents database corruption by an illegal transaction. An example of a database invariant is referential integrity, which guarantees the primary keyforeign key relationship.[7]

Isolation

edit

Transactions are often executed concurrently (e.g., multiple transactions reading and writing to a table at the same time). Isolation ensures that concurrent execution of transactions leaves the database in the same state that would have been obtained if the transactions were executed sequentially. Isolation is the main goal of concurrency control; depending on the isolation level used, the effects of an incomplete transaction might not be visible to other transactions.[8]

Durability

edit

Durability guarantees that once a transaction has been committed, it will remain committed even in the case of a system failure (e.g., power outage or crash). This usually means that completed transactions (or their effects) are recorded in non-volatile memory.[9]

Examples

edit

The following examples further illustrate the ACID properties. In these examples, the database table has two columns, A and B. An integrity constraint requires that the value in A and the value in B must sum to 100. The following SQL code creates a table as described above:

CREATE TABLE acidtest (A INTEGER, B INTEGER, CHECK (A + B = 100));

Atomicity

edit

Atomicity is the guarantee that series of database operations in an atomic transaction will either all occur (a successful operation), or none will occur (an unsuccessful operation). The series of operations cannot be separated with only some of them being executed, which makes the series of operations "indivisible". A guarantee of atomicity prevents updates to the database from occurring only partially, which can cause greater problems than rejecting the whole series outright. In other words, atomicity means indivisibility and irreducibility.[10] Alternatively, we may say that a logical transaction may be composed of several physical transactions. Unless and until all component physical transactions are executed, the logical transaction will not have occurred.

An example of an atomic transaction is a monetary transfer from bank account A to account B. It consists of two operations, withdrawing the money from account A and depositing it to account B. We would not want to see the amount removed from account A before we are sure it has also been transferred into account B. Performing these operations in an atomic transaction ensures that the database remains in a consistent state, that is, money is neither debited nor credited if either of those two operations fails.[11]

Consistency failure

edit

Consistency is a very general term, which demands that the data must meet all validation rules. In the previous example, the validation is a requirement that A + B = 100. All validation rules must be checked to ensure consistency. Assume that a transaction attempts to subtract 10 from A without altering B. Because consistency is checked after each transaction, it is known that A + B = 100 before the transaction begins. If the transaction removes 10 from A successfully, atomicity will be achieved. However, a validation check will show that A + B = 90, which is inconsistent with the rules of the database. The entire transaction must be canceled and the affected rows rolled back to their pre-transaction state. If there had been other constraints, triggers, or cascades, every single change operation would have been checked in the same way as above before the transaction was committed. Similar issues may arise with other constraints. We may have required the data types of both A and B to be integers. If we were then to enter, say, the value 13.5 for A, the transaction will be canceled, or the system may give rise to an alert in the form of a trigger (if/when the trigger has been written to this effect). Another example would be integrity constraints, which would not allow us to delete a row in one table whose primary key is referred to by at least one foreign key in other tables.

Isolation failure

edit

To demonstrate isolation, we assume two transactions execute at the same time, each attempting to modify the same data. One of the two must wait until the other completes in order to maintain isolation.

Consider two transactions:

  • T1 transfers 10 from A to B.
  • T2 transfers 20 from B to A.

Combined, there are four actions:

  1. T1 subtracts 10 from A.
  2. T1 adds 10 to B.
  3. T2 subtracts 20 from B.
  4. T2 adds 20 to A.

If these operations are performed in order, isolation is maintained, although T2 must wait. Consider what happens if T1 fails halfway through. The database eliminates T1's effects, and T2 sees only valid data.

By interleaving the transactions, the actual order of actions might be:

  1. T1 subtracts 10 from A.
  2. T2 subtracts 20 from B.
  3. T2 adds 20 to A.
  4. T1 adds 10 to B.

Again, consider what happens if T1 fails while modifying B in Step 4. By the time T1 fails, T2 has already modified A; it cannot be restored to the value it had before T1 without leaving an invalid database. This is known as a write-write contention,[12] because two transactions attempted to write to the same data field. In a typical system, the problem would be resolved by reverting to the last known good state, canceling the failed transaction T1, and restarting the interrupted transaction T2 from the good state.

Durability failure

edit

Consider a transaction that transfers 10 from A to B. First, it removes 10 from A, then it adds 10 to B. At this point, the user is told the transaction was a success. However, the changes are still queued in the disk buffer waiting to be committed to disk. Power fails and the changes are lost, but the user assumes (understandably) that the changes persist.

Implementation

edit

Processing a transaction often requires a sequence of operations that is subject to failure for a number of reasons. For instance, the system may have no room left on its disk drives, or it may have used up its allocated CPU time. There are two popular families of techniques: write-ahead logging and shadow paging. In both cases, locks must be acquired on all information to be updated, and depending on the level of isolation, possibly on all data that may be read as well. In write ahead logging, durability is guaranteed by writing the prospective change to a persistent log before changing the database. That allows the database to return to a consistent state in the event of a crash. In shadowing, updates are applied to a partial copy of the database, and the new copy is activated when the transaction commits.

Locking vs. multiversioning

edit

Many databases rely upon locking to provide ACID capabilities. Locking means that the transaction marks the data that it accesses so that the DBMS knows not to allow other transactions to modify it until the first transaction succeeds or fails. The lock must always be acquired before processing data, including data that is read but not modified. Non-trivial transactions typically require a large number of locks, resulting in substantial overhead as well as blocking other transactions. For example, if user A is running a transaction that has to read a row of data that user B wants to modify, user B must wait until user A's transaction completes. Two-phase locking is often applied to guarantee full isolation.

An alternative to locking is multiversion concurrency control, in which the database provides each reading transaction the prior, unmodified version of data that is being modified by another active transaction. This allows readers to operate without acquiring locks, i.e., writing transactions do not block reading transactions, and readers do not block writers. Going back to the example, when user A's transaction requests data that user B is modifying, the database provides A with the version of that data that existed when user B started his transaction. User A gets a consistent view of the database even if other users are changing data. One implementation, namely snapshot isolation, relaxes the isolation property.

Distributed transactions

edit

Guaranteeing ACID properties in a distributed transaction across a distributed database, where no single node is responsible for all data affecting a transaction, presents additional complications. Network connections might fail, or one node might successfully complete its part of the transaction and then be required to roll back its changes because of a failure on another node. The two-phase commit protocol (not to be confused with two-phase locking) provides atomicity for distributed transactions to ensure that each participant in the transaction agrees on whether the transaction should be committed or not.[13] Briefly, in the first phase, one node (the coordinator) interrogates the other nodes (the participants), and only when all reply that they are prepared does the coordinator, in the second phase, formalize the transaction.

See also

edit

References

edit
  1. ^ Haerder, T.; Reuter, A. (1983). "Principles of transaction-oriented database recovery". ACM Computing Surveys. 15 (4): 287. doi:10.1145/289.291. S2CID?207235758.
  2. ^ Gray, Jim (September 1981). "The Transaction Concept: Virtues and Limitations" (PDF). Proceedings of the 7th International Conference on Very Large Databases. Cupertino, California: Tandem Computers. pp.?144–154. Retrieved March 27, 2015.
  3. ^ Gray, Jim; Reuter, Andreas (1993). Distributed Transaction Processing: Concepts and Techniques. Morgan Kaufmann. ISBN?1-55860-190-2.
  4. ^ "ACID vs BASE Databases - Difference Between Databases - AWS". Amazon Web Services, Inc. Retrieved 2025-08-08.
  5. ^ "ACID vs BASE Databases - Difference Between Databases - AWS". Amazon Web Services, Inc. Retrieved 2025-08-08.
  6. ^ "Atomic operation". webopedia.com. Webopedia. 25 November 2003. Retrieved 2025-08-08. An operation during which a processor can simultaneously read a location and write it in the same bus operation. This prevents any other processor or I/O device from writing or reading memory until the operation is complete.
  7. ^ C. J. Date, "SQL and Relational Theory: How to Write Accurate SQL Code 2nd edition", O'reilly Media, Inc., 2012, p. 180.
  8. ^ Archiveddocs (2025-08-08). "Isolation Levels in the Database Engine". learn.microsoft.com. Retrieved 2025-08-08.
  9. ^ Silberschatz, Abraham; Korth, Henry F.; Sudarshan, S. (2011). "Transactions". Database system concepts (6th?ed.). New York: McGraw-Hill. p.?631. ISBN?978-0-07-352332-3. OCLC?436031093.
  10. ^ "Atomicity". docs.oracle.com. Retrieved 2025-08-08.
  11. ^ Amsterdam, Jonathan. "Atomic File Transactions, Part 1". O'Reilly. Archived from the original on 2025-08-08. Retrieved 2025-08-08.
  12. ^ Silberschatz, Abraham; Korth, Henry F.; Sudarshan, S. (2011). "Advanced Application Development". Database system concepts (6th?ed.). New York: McGraw-Hill. p.?1042. ISBN?978-0-07-352332-3. OCLC?436031093.
  13. ^ Bernstein, Philip A.; Newcomer, Eric (2009). "Chapter 8". Principles of Transaction Processing (2nd?ed.). Morgan Kaufmann (Elsevier). ISBN?978-1-55860-623-4. Archived from the original on 2025-08-08.
1944年属什么生肖 虚病是什么意思 附骨疽在现代叫什么病 苦瓜炒什么好吃 gfr是什么意思
肾功能不全有什么症状 prada是什么品牌 胰腺上长瘤意味着什么 invent是什么意思 基友什么意思
眉毛淡的女人代表什么 西洋参什么季节吃最好 人棉是什么面料 腹部超声检查什么 阿胶不能和什么一起吃
耳仓为什么是臭的 三七粉主治什么病 既寿永昌什么意思 血脂看什么指标 everytime什么意思
吃什么减肥快aiwuzhiyu.com 耳朵听不清楚是什么原因hcv9jop7ns3r.cn 提供什么hcv7jop6ns9r.cn 如什么如什么的成语hcv8jop0ns5r.cn 虚火牙痛吃什么药效果最快zhiyanzhang.com
桉字五行属什么hcv9jop1ns2r.cn 血小板低是什么问题hcv7jop9ns4r.cn 备孕叶酸什么时候吃最好hcv9jop4ns5r.cn 镇长什么级别hcv8jop4ns0r.cn cvm是什么意思hcv8jop0ns8r.cn
餐后胆囊是什么意思hcv8jop1ns5r.cn 流汗多是什么原因hcv8jop7ns0r.cn 辣椒炒肉用什么辣椒hcv9jop5ns3r.cn 小生化是检查什么项目hcv9jop3ns4r.cn 花子是什么意思hcv8jop4ns1r.cn
梦见别人怀孕了是什么意思hcv9jop0ns1r.cn 爸爸的姥姥叫什么baiqunet.com 月经不正常去医院检查什么项目hcv9jop5ns3r.cn 吃秋葵有什么好处hcv8jop5ns6r.cn 月完念什么hcv8jop7ns2r.cn
百度