# ACID & BASE Properties

## **ACID Properties (SQL Databases)**

ACID ensures **data reliability and consistency** in relational databases by enforcing strict transactional integrity.

* **Atomicity** → Transactions are **all-or-nothing** (e.g., a bank transfer completes fully or not at all).
* **Consistency** → Data **always remains valid** according to predefined rules (e.g., referential integrity).
* **Isolation** → Transactions **run independently** to prevent conflicts (e.g., locking mechanisms).
* **Durability** → Once committed, data is **permanently saved** even after failures (e.g., disk persistence).

**Best For:** Banking, finance, healthcare, stock trading.

## **BASE Properties (NoSQL Databases)**

BASE **prioritizes availability and scalability** over strict consistency, making it ideal for distributed systems.

* **Basically Available** → System **remains operational** despite failures (e.g., partial data availability).
* **Soft State** → Data **may change** over time due to background replication.
* **Eventually Consistent** → Data **syncs across nodes** but not instantly (e.g., DNS updates, social media posts).

**Best For:** Social media, e-commerce, IoT, big data analytics.

## **Comparison**

<table data-full-width="true"><thead><tr><th>Feature</th><th>ACID (SQL)</th><th>BASE (NoSQL)</th></tr></thead><tbody><tr><td><strong>Consistency</strong></td><td>Strong (Immediate)</td><td>Weak (Eventual)</td></tr><tr><td><strong>Availability</strong></td><td>Lower</td><td>Higher</td></tr><tr><td><strong>Scalability</strong></td><td>Limited</td><td>Highly Scalable</td></tr><tr><td><strong>Use Case</strong></td><td>Critical transactions</td><td>High-speed, distributed systems</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.pranaypourkar.co.in/the-programmers-guide/database/sql-vs-nosql/acid-and-base-properties.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
