<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Amjad]]></title><description><![CDATA[software engineering]]></description><link>https://blog.amjad.codes</link><image><url>https://cloudmate-test.s3.us-east-1.amazonaws.com/uploads/logos/623660408e4fae3f767ddf9f/def48ac5-b60b-415c-8119-1eaf79194e34.png</url><title>Amjad</title><link>https://blog.amjad.codes</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 18:51:05 GMT</lastBuildDate><atom:link href="https://blog.amjad.codes/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[ACID and BASE in Databases: Key Differences Explained]]></title><description><![CDATA[ACID and BASE are acronyms for different database properties, describing how the database behaves during processing a transaction,

ACID:
A: Atomicity:
it ensures that all steps or statements in a transaction are fully applied committed, or fully rev...]]></description><link>https://blog.amjad.codes/acid-vs-base</link><guid isPermaLink="true">https://blog.amjad.codes/acid-vs-base</guid><category><![CDATA[database]]></category><category><![CDATA[SQL]]></category><category><![CDATA[NoSQL]]></category><category><![CDATA[ACID Transactions]]></category><category><![CDATA[Databases]]></category><dc:creator><![CDATA[Amjad AH]]></dc:creator><pubDate>Sat, 25 Jan 2025 21:34:34 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/lRoX0shwjUQ/upload/364894ebe45bfdd8b8f7d26eb8a22a21.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>ACID</strong> and <strong>BASE</strong> are acronyms for different database properties, describing how the database behaves during processing a transaction,</p>
<hr />
<h2 id="heading-acid">ACID:</h2>
<h3 id="heading-a-atomicity">A: Atomicity:</h3>
<p>it ensures that all steps or statements in a transaction are fully applied <code>committed</code>, or fully reverted <code>rolled-back</code>,</p>
<p>for example, if we have an ordering system, which has <code>orders</code> table, and <code>order_items</code> table, while placing an order, we want to insert the order first, them the order items, imagine that the connection lost or any error occurred after inserting the order, now we have an empty order without any items in it, this is where we will need to roll-back the order insertion, to avoid the empty order.</p>
<h3 id="heading-c-consistency">C: Consistency:</h3>
<p>it ensures that the data integrity, even when we have multiple users using the system at the same time,</p>
<p>for example, let’s build on the example before, let’s imagine that <code>orders</code> table has a column named <code>total</code>, which refers to the total amount of the order, and <code>order_items</code> table has a column named <code>price</code>, the value of <code>orders.total</code> should be <strong>exactly</strong> <code>sum(order_items.price</code>.</p>
<h3 id="heading-i-isolation">I: Isolation:</h3>
<p>it ensures that any new transaction should wait for other transactions which are working on the same records to finish, to make sure that concurrent transactions <strong>don’t interfere with each</strong> other,</p>
<p>for example, let’s continue building on the same example, imagine a user is order the last item of a specific product, and at the same time another one is trying to buy the same product, the second transaction should wait for the first one to finish so it can proceed.</p>
<h3 id="heading-d-durability">D: Durability:</h3>
<p>it ensures that once a transaction is committed to the database, it will <strong>never</strong> get lost, even if the system experienced failure or anything,</p>
<p>for example, in the same ordering system, once you have placed an order, it can never be lost</p>
<hr />
<h2 id="heading-base">BASE:</h2>
<h3 id="heading-ba-basically-available">BA: Basically Available:</h3>
<p>it means that the system will <strong>always respond to requests</strong>, even if some parts of it are failing or operating with degraded performance. Instead of guaranteeing immediate consistency (like <strong>ACID</strong>), the system prioritizes <strong>availability</strong> by allowing temporary inconsistencies.</p>
<h3 id="heading-s-soft-state">S: Soft State:</h3>
<p>it means that the state of the data can be changed automatically, even without any external triggers or inputs, This contrasts with a <strong>strictly consistent state</strong> (like <strong>ACID</strong>), where the data is immediately consistent after each transaction.</p>
<h3 id="heading-e-eventually-consistent">E: <strong>Eventually consistent:</strong></h3>
<p>it means the system may allow <strong>temporarily</strong> inconsistent data, that will <strong>eventually</strong> converge to a consistent state after a period of time, as long as no new updates are made.</p>
<hr />
<h2 id="heading-key-differences-between-acid-and-base">Key Differences Between ACID and BASE:</h2>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Feature</strong></td><td><strong>ACID</strong></td><td><strong>BASE</strong></td></tr>
</thead>
<tbody>
<tr>
<td><strong>Consistency</strong></td><td>strict and immediate</td><td>eventual</td></tr>
<tr>
<td><strong>Availability</strong></td><td>sacrifices availability</td><td>prioritiezes availability</td></tr>
<tr>
<td><strong>Complexity</strong></td><td>higher</td><td>simpler</td></tr>
<tr>
<td><strong>Use Cases</strong></td><td>finance, sensitive data…</td><td>social media, insensitive data…</td></tr>
<tr>
<td><strong>Performance</strong></td><td>slower, due to strict rules</td><td>faster</td></tr>
</tbody>
</table>
</div>]]></content:encoded></item></channel></rss>