Nâng CaoDatabase iconDatabase

ACID properties trong database là gì?

ACID: Atomicity (all-or-nothing), Consistency (constraints always satisfied), Isolation (concurrent transactions don't see each other's intermediate state), Durability (committed data survives crashes via WAL).

  • BASE là alternative của NoSQL.
  • ACID đảm bảo database transactions đáng tin cậy.
  • Atomicity: transaction thành công toàn bộ hoặc rollback toàn bộ — ví dụ bank transfer trừ $100 từ account A và cộng $100 vào account B phải là một đơn vị; nếu bước 2 fail, bước 1 phải rollback.
  • Consistency: data luôn ở trạng thái hợp lệ theo constraints — ví dụ foreign key constraint đảm bảo không thể tạo order với non-existent userId.
  • Isolation: concurrent transactions không thấy intermediate state của nhau — mức độ isolation khác nhau (READ COMMITTED, SERIALIZABLE).
  • Durability: committed data không mất dù server crash — PostgreSQL dùng WAL (Write-Ahead Log) để ghi log trước khi apply changes, có thể replay để recover.
  • Implementation khác nhau: PostgreSQL full ACID; MySQL InnoDB hỗ trợ ACID, MyISAM không; MongoDB 4.0+ ACID multi-document transactions nhưng performance cao hơn single-document operations.
  • BASE (Basically Available, Soft state, Eventual consistency) là alternative cho NoSQL systems như Cassandra — ưu tiên availability và performance over strict consistency, phù hợp cho hệ thống cần scale cực lớn.

Xem toàn bộ Database cùng filter theo level & chủ đề con.

Mở danh sách Database