✓ Data có cấu trúc rõ ràng (schema cố định)
✓ Relationships phức tạp (foreign keys, joins)
✓ Cần ACID transactions
✓ Data integrity quan trọng
✓ Query patterns đa dạng (ad-hoc queries)
Ví dụ: Banking, ERP, E-commerce orders, CRM
1.3 熱門:PostgreSQL 與 MySQL
特點
PostgreSQL
MySQL
酸
完整
完整(InnoDB)
JSON 支援
優(JSONB)
好
全文搜尋
內建
內建
複製
串流媒體,邏輯
二進位日誌
擴展
TimescaleDB、PostGIS
有限公司
最適合
複雜查詢,資料完整性
網頁應用程序,閱讀量大
2. NoSQL 類別
2.1 鍵值存儲
SET user:123 → {"name": "John", "email": "[email protected]"}
GET user:123 → {"name": "John", "email": "[email protected]"}
Cực nhanh: O(1) read/write
Hạn chế: Không có query phức tạp, không có relationships
Row Key: user_123
Column Family "profile":
name: "John"
email: "[email protected]"
Column Family "activity":
last_login: "2026-03-30"
posts_count: 42
Mỗi row có thể có columns khác nhau
→ Linh hoạt cho IoT, time-series, analytics
資料庫
最適合
卡桑德拉
高寫入吞吐量、多資料中心
HBase
Hadoop 生態系、分析
ScyllaDB
相容於Cassandra,效能更高
2.4 圖表資料庫
(John) ─[FRIENDS_WITH]─► (Jane)
(John) ─[WORKS_AT]────► (Google)
(Jane) ─[LIVES_IN]────► (Hanoi)
(John) ─[LIKES]───────► (Post_123)
Query: "Tìm bạn của bạn John sống ở Hà Nội"
→ Cực nhanh với Graph DB, cực chậm với SQL (multiple JOINs)