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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ChΖ°Ζ‘ng 9: TΓch hợp Dα»― liα»u Δa mΓ΄ hΓ¬nh vΓ CSDL Hiα»n ΔαΊ‘i
|
| 2 |
+
## Multi-model Data Integration & Modern Databases
|
| 3 |
+
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
## π Mα»₯c tiΓͺu hα»c tαΊp (CLO5, CLO6, CLO8, CLO9)
|
| 7 |
+
|
| 8 |
+
Sau khi hoΓ n thΓ nh chΖ°Ζ‘ng nΓ y, sinh viΓͺn cΓ³ thα»:
|
| 9 |
+
- Hiα»u kiαΊΏn trΓΊc Polyglot Persistence vΓ khi nΓ o cαΊ§n multi-model
|
| 10 |
+
- TΓch hợp Knowledge Graph vΓ o DWH
|
| 11 |
+
- Xα» lΓ½ Vector data cho semantic search
|
| 12 |
+
- Hiα»u Blockchain cho data integrity
|
| 13 |
+
- Implement Federated Querying across multiple engines
|
| 14 |
+
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
## 9.1. KiαΊΏn trΓΊc Polyglot Persistence
|
| 18 |
+
|
| 19 |
+
```
|
| 20 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 21 |
+
β POLYGLOT PERSISTENCE β
|
| 22 |
+
β β
|
| 23 |
+
β "DΓΉng ΔΓΊng database cho ΔΓΊng use case" β
|
| 24 |
+
β β
|
| 25 |
+
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
|
| 26 |
+
β βRelationalβ β Document β β Graph β β Vector β β
|
| 27 |
+
β β(Postgres)β β (Mongo) β β (Neo4j) β β (Chroma) β β
|
| 28 |
+
β β β β β β β β β β
|
| 29 |
+
β β Orders β β Product β β Customer β β Review β β
|
| 30 |
+
β β Payments β β Catalog β β Network β β Embeddingsβ β
|
| 31 |
+
β β Star β β (nested β β (social, β β Semantic β β
|
| 32 |
+
β β Schema β β JSON) β β product β β Search β β
|
| 33 |
+
β β β β β β graph) β β β β
|
| 34 |
+
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
|
| 35 |
+
β β β β β β
|
| 36 |
+
β ββββββββββββββββΌβββββββββββββΌβββββββββββββ β
|
| 37 |
+
β β β β
|
| 38 |
+
β βββββββββΌβββββββββββββΌβββββββ β
|
| 39 |
+
β β Unified Query Engine β β
|
| 40 |
+
β β (Presto/Trino/Spark) β β
|
| 41 |
+
β βββββββββββββββββββββββββββββ β
|
| 42 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 43 |
+
|
| 44 |
+
Database Types Summary:
|
| 45 |
+
ββββββββββββββββ¬ββββββββββββββββ¬βββββββββββββββββββββββββββ
|
| 46 |
+
β Type β Best for β Examples β
|
| 47 |
+
ββββββββββββββββΌββββββββββββββββΌβββββββββββββββββββββββββββ€
|
| 48 |
+
β Relational β ACID, Joins β PostgreSQL, MySQL β
|
| 49 |
+
β Document β Flexible JSON β MongoDB, DynamoDB β
|
| 50 |
+
β Key-Value β Fast lookup β Redis, Memcached β
|
| 51 |
+
β Column-familyβ Time series β ClickHouse, Cassandra β
|
| 52 |
+
β Graph β Relationships β Neo4j, Amazon Neptune β
|
| 53 |
+
β Vector β Similarity β ChromaDB, Pinecone β
|
| 54 |
+
β Time series β Temporal data β InfluxDB, TimescaleDB β
|
| 55 |
+
ββββββββββββββββ΄ββββββββββββββββ΄βββββββββββββββββββββββββββ
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
---
|
| 59 |
+
|
| 60 |
+
## 9.2. Knowledge Graph
|
| 61 |
+
|
| 62 |
+
### TΓch hợp Graph Database cho Olist
|
| 63 |
+
|
| 64 |
+
```
|
| 65 |
+
Olist Knowledge Graph:
|
| 66 |
+
|
| 67 |
+
(Customer:C001) ββ[PLACED]βββ (Order:O001)
|
| 68 |
+
β β
|
| 69 |
+
β [CONTAINS]
|
| 70 |
+
[LIVES_IN] β
|
| 71 |
+
β (Product:P001)
|
| 72 |
+
βΌ β β
|
| 73 |
+
(City:SaoPaulo) [BELONGS_TO] [SOLD_BY]
|
| 74 |
+
β β β
|
| 75 |
+
[IN_STATE] (Category: (Seller:S001)
|
| 76 |
+
β Beauty) β
|
| 77 |
+
βΌ [LOCATED_IN]
|
| 78 |
+
(State:SP) β
|
| 79 |
+
(City:Curitiba)
|
| 80 |
+
|
| 81 |
+
Graph Queries (Cypher):
|
| 82 |
+
|
| 83 |
+
-- TΓ¬m sαΊ£n phαΊ©m thΖ°α»ng mua cΓΉng
|
| 84 |
+
MATCH (p1:Product)<-[:CONTAINS]-(o:Order)-[:CONTAINS]->(p2:Product)
|
| 85 |
+
WHERE p1.id <> p2.id
|
| 86 |
+
RETURN p1.category, p2.category, COUNT(*) AS co_purchase
|
| 87 |
+
ORDER BY co_purchase DESC
|
| 88 |
+
LIMIT 10;
|
| 89 |
+
|
| 90 |
+
-- Customer journey analysis
|
| 91 |
+
MATCH path = (c:Customer)-[:PLACED]->(o:Order)-[:CONTAINS]->(p:Product)
|
| 92 |
+
WHERE c.id = 'C001'
|
| 93 |
+
RETURN path;
|
| 94 |
+
|
| 95 |
+
-- Seller performance network
|
| 96 |
+
MATCH (s:Seller)-[:SOLD]->(p:Product)<-[:REVIEWED {score: 1}]-(c:Customer)
|
| 97 |
+
RETURN s.id, COUNT(*) AS bad_reviews
|
| 98 |
+
ORDER BY bad_reviews DESC;
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
---
|
| 102 |
+
|
| 103 |
+
## 9.3. Vector Data & Indexing
|
| 104 |
+
|
| 105 |
+
### Kα»Ή thuαΊt lαΊp chα» mα»₯c cho dα»― liα»u chiα»u cao
|
| 106 |
+
|
| 107 |
+
```
|
| 108 |
+
Vector Indexing Methods:
|
| 109 |
+
|
| 110 |
+
1. Flat (Brute-force):
|
| 111 |
+
- Compare query with EVERY vector
|
| 112 |
+
- Exact results but O(n*d)
|
| 113 |
+
- Good for < 10K vectors
|
| 114 |
+
|
| 115 |
+
2. IVF (Inverted File Index):
|
| 116 |
+
ββββββββ ββββββββ ββββββββ
|
| 117 |
+
βCell 1β βCell 2β βCell 3β β Voronoi cells
|
| 118 |
+
β . . β β . . β β . β
|
| 119 |
+
β . β β . . β β . . β
|
| 120 |
+
ββββββββ ββββββββ ββββββββ
|
| 121 |
+
Query β Find nearest cell β Search within cell
|
| 122 |
+
β Approximate but much faster
|
| 123 |
+
|
| 124 |
+
3. HNSW (Hierarchical Navigable Small World):
|
| 125 |
+
Layer 3: O βββββββββββ O
|
| 126 |
+
Layer 2: O ββ O ββββββ O ββ O
|
| 127 |
+
Layer 1: OβOβOβOββOβOβOβOβOβO
|
| 128 |
+
Layer 0: OOOOOOOOOOOOOOOOOOOOOO
|
| 129 |
+
β Navigate from top layer down
|
| 130 |
+
β Best for high-dimensional, large-scale
|
| 131 |
+
|
| 132 |
+
4. PQ (Product Quantization):
|
| 133 |
+
Vector [1.2, 0.5, -0.3, ...] β Compressed [3, 7, 1, ...]
|
| 134 |
+
β Lossy compression, trades accuracy for speed+memory
|
| 135 |
+
|
| 136 |
+
Distance Metrics:
|
| 137 |
+
- Cosine Similarity: cos(ΞΈ) = AΒ·B / (|A|*|B|) β Semantic similarity
|
| 138 |
+
- Euclidean (L2): βΞ£(ai-bi)Β² β Geometric distance
|
| 139 |
+
- Inner Product (IP): AΒ·B β Raw dot product
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
### pgvector Example (PostgreSQL)
|
| 143 |
+
|
| 144 |
+
```sql
|
| 145 |
+
-- Enable pgvector extension
|
| 146 |
+
CREATE EXTENSION IF NOT EXISTS vector;
|
| 147 |
+
|
| 148 |
+
-- Create table with vector column
|
| 149 |
+
CREATE TABLE review_embeddings (
|
| 150 |
+
review_id VARCHAR(50) PRIMARY KEY,
|
| 151 |
+
review_text TEXT,
|
| 152 |
+
embedding VECTOR(384), -- 384-dim embedding
|
| 153 |
+
review_score SMALLINT
|
| 154 |
+
);
|
| 155 |
+
|
| 156 |
+
-- Create HNSW index
|
| 157 |
+
CREATE INDEX ON review_embeddings
|
| 158 |
+
USING hnsw (embedding vector_cosine_ops);
|
| 159 |
+
|
| 160 |
+
-- Semantic search: Find reviews similar to "delivery was late"
|
| 161 |
+
SELECT review_id, review_text, review_score,
|
| 162 |
+
1 - (embedding <=> '[0.1, -0.3, ...]'::vector) AS similarity
|
| 163 |
+
FROM review_embeddings
|
| 164 |
+
ORDER BY embedding <=> '[0.1, -0.3, ...]'::vector
|
| 165 |
+
LIMIT 10;
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
---
|
| 169 |
+
|
| 170 |
+
## 9.4. Blockchain cho Data Integrity
|
| 171 |
+
|
| 172 |
+
```
|
| 173 |
+
Blockchain Audit Trail:
|
| 174 |
+
|
| 175 |
+
βββββββββββββ βββββββββββββ βββββββββββββ βββββββββββββ
|
| 176 |
+
β Block #1 ββββββ Block #2 ββββββ Block #3 ββββββ Block #4 β
|
| 177 |
+
β β β β β β β β
|
| 178 |
+
β prev: 0x0 β β prev: 0xaβ β prev: 0xbβ β prev: 0xcβ
|
| 179 |
+
β hash: 0xa β β hash: 0xbβ β hash: 0xcβ β hash: 0xdβ
|
| 180 |
+
β β β β β β β β
|
| 181 |
+
β Data: β β Data: β β Data: β β Data: β
|
| 182 |
+
β Schema v1 β β ETL run β β Model v2 β β Access β
|
| 183 |
+
β created β β 5000 rows β β deployed β β by user X β
|
| 184 |
+
β β β loaded β β AUC=0.85 β β at 14:30 β
|
| 185 |
+
βββββββββββββ βββββββββββββ βββββββββββββ βββββββββββββ
|
| 186 |
+
|
| 187 |
+
Immutable! NαΊΏu ai sα»a Block #2 β hash thay Δα»i β
|
| 188 |
+
Block #3 prev hash khΓ΄ng khα»p β Chain broken β Tamper detected!
|
| 189 |
+
|
| 190 |
+
Use cases trong DWH:
|
| 191 |
+
1. Metadata Audit Logs: Ai thay Δα»i schema, khi nΓ o
|
| 192 |
+
2. Data Provenance: Chα»©ng minh data khΓ΄ng bα» sα»a
|
| 193 |
+
3. Compliance: Regulatory audit trail (AI Act)
|
| 194 |
+
4. Data Sharing: Verify data integrity khi share cross-org
|
| 195 |
+
```
|
| 196 |
+
|
| 197 |
+
---
|
| 198 |
+
|
| 199 |
+
## 9.5. Blockchain for Data Integrity
|
| 200 |
+
|
| 201 |
+
### Implementation Pattern
|
| 202 |
+
|
| 203 |
+
```python
|
| 204 |
+
import hashlib
|
| 205 |
+
import json
|
| 206 |
+
from datetime import datetime
|
| 207 |
+
|
| 208 |
+
class AuditBlock:
|
| 209 |
+
def __init__(self, index, data, previous_hash):
|
| 210 |
+
self.index = index
|
| 211 |
+
self.timestamp = datetime.now().isoformat()
|
| 212 |
+
self.data = data
|
| 213 |
+
self.previous_hash = previous_hash
|
| 214 |
+
self.hash = self.calculate_hash()
|
| 215 |
+
|
| 216 |
+
def calculate_hash(self):
|
| 217 |
+
block_string = json.dumps({
|
| 218 |
+
'index': self.index,
|
| 219 |
+
'timestamp': self.timestamp,
|
| 220 |
+
'data': self.data,
|
| 221 |
+
'previous_hash': self.previous_hash
|
| 222 |
+
}, sort_keys=True)
|
| 223 |
+
return hashlib.sha256(block_string.encode()).hexdigest()
|
| 224 |
+
|
| 225 |
+
class AuditChain:
|
| 226 |
+
def __init__(self):
|
| 227 |
+
self.chain = [self._create_genesis_block()]
|
| 228 |
+
|
| 229 |
+
def _create_genesis_block(self):
|
| 230 |
+
return AuditBlock(0, {"event": "Chain initialized"}, "0")
|
| 231 |
+
|
| 232 |
+
def add_event(self, event_data):
|
| 233 |
+
previous_block = self.chain[-1]
|
| 234 |
+
new_block = AuditBlock(
|
| 235 |
+
len(self.chain), event_data, previous_block.hash
|
| 236 |
+
)
|
| 237 |
+
self.chain.append(new_block)
|
| 238 |
+
return new_block
|
| 239 |
+
|
| 240 |
+
def verify_integrity(self):
|
| 241 |
+
for i in range(1, len(self.chain)):
|
| 242 |
+
current = self.chain[i]
|
| 243 |
+
previous = self.chain[i-1]
|
| 244 |
+
|
| 245 |
+
if current.hash != current.calculate_hash():
|
| 246 |
+
return False, f"Block {i} hash tampered"
|
| 247 |
+
if current.previous_hash != previous.hash:
|
| 248 |
+
return False, f"Block {i} chain broken"
|
| 249 |
+
|
| 250 |
+
return True, "Chain integrity verified"
|
| 251 |
+
```
|
| 252 |
+
|
| 253 |
+
---
|
| 254 |
+
|
| 255 |
+
## 9.6. Federated Querying
|
| 256 |
+
|
| 257 |
+
```
|
| 258 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 259 |
+
β FEDERATED QUERY ENGINE β
|
| 260 |
+
β (Trino / Presto / Spark) β
|
| 261 |
+
β β
|
| 262 |
+
β SELECT c.name, o.total, g.label β
|
| 263 |
+
β FROM postgres.orders o β
|
| 264 |
+
β JOIN neo4j.customer_graph g ON o.cust = g.id β
|
| 265 |
+
β JOIN clickhouse.realtime r ON o.id = r.order_id β
|
| 266 |
+
β β
|
| 267 |
+
β β 1 SQL query across 3 databases! β
|
| 268 |
+
βββββββββββββ¬ββββββββββββ¬ββββββββββββ¬βββββββββββββββ
|
| 269 |
+
β β β
|
| 270 |
+
ββββββββΌβββ ββββββΌβββββ ββββΌββββββββββ
|
| 271 |
+
βPostgres β β Neo4j β β ClickHouse β
|
| 272 |
+
β(Star β β(Graph) β β(Real-time) β
|
| 273 |
+
β Schema) β β β β β
|
| 274 |
+
βββββββββββ βββββββββββ ββββββββββββββ
|
| 275 |
+
|
| 276 |
+
Trino Catalog Configuration:
|
| 277 |
+
|
| 278 |
+
# PostgreSQL catalog
|
| 279 |
+
connector.name=postgresql
|
| 280 |
+
connection-url=jdbc:postgresql://host:5432/olist_dw
|
| 281 |
+
|
| 282 |
+
# ClickHouse catalog
|
| 283 |
+
connector.name=clickhouse
|
| 284 |
+
connection-url=jdbc:clickhouse://host:8123/realtime_db
|
| 285 |
+
```
|
| 286 |
+
|
| 287 |
+
---
|
| 288 |
+
|
| 289 |
+
## 9.7. Multi-model Query Optimization
|
| 290 |
+
|
| 291 |
+
```
|
| 292 |
+
Optimization Strategies:
|
| 293 |
+
|
| 294 |
+
1. Pushdown Predicates:
|
| 295 |
+
β Push WHERE clauses to source databases
|
| 296 |
+
β Reduce data transfer
|
| 297 |
+
|
| 298 |
+
2. Join Ordering:
|
| 299 |
+
β Join smaller tables first
|
| 300 |
+
β Use broadcast join for small dims
|
| 301 |
+
|
| 302 |
+
3. Materialized Views:
|
| 303 |
+
β Pre-compute cross-database joins
|
| 304 |
+
β Refresh on schedule
|
| 305 |
+
|
| 306 |
+
4. Caching:
|
| 307 |
+
β Cache frequently accessed data
|
| 308 |
+
β Time-based invalidation
|
| 309 |
+
```
|
| 310 |
+
|
| 311 |
+
---
|
| 312 |
+
|
| 313 |
+
## 9.8. High Availability & Disaster Recovery
|
| 314 |
+
|
| 315 |
+
```
|
| 316 |
+
HA/DR Architecture:
|
| 317 |
+
|
| 318 |
+
Region A (Primary) Region B (Secondary)
|
| 319 |
+
ββββββββββββββββββ ββββββββββββββββββ
|
| 320 |
+
β App Servers β β App Servers β
|
| 321 |
+
β (Active) β β (Standby) β
|
| 322 |
+
β β β β
|
| 323 |
+
β ββββββββββββ β Sync β ββββββββββββ β
|
| 324 |
+
β β Primary ββββΌββββββββββ β Replica β β
|
| 325 |
+
β β DB β β Async β β DB β β
|
| 326 |
+
β ββββββββββββ β β ββββββββββββ β
|
| 327 |
+
β β β β
|
| 328 |
+
β ββββββββββββ β Sync β ββββββββββββ β
|
| 329 |
+
β β Object ββββΌββββββββββ β Object β β
|
| 330 |
+
β β Storage β β β β Storage β β
|
| 331 |
+
β ββββββββββββ β β ββββββββββββ β
|
| 332 |
+
ββββββββββββββββββ ββββββββββββββββββ
|
| 333 |
+
|
| 334 |
+
RPO (Recovery Point Objective): How much data can you lose?
|
| 335 |
+
RTO (Recovery Time Objective): How fast must you recover?
|
| 336 |
+
|
| 337 |
+
ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 338 |
+
β Strategy β RPO β RTO β
|
| 339 |
+
ββββββββββββββββββΌβββββββββββββΌββββββββββοΏ½οΏ½οΏ½ββββ€
|
| 340 |
+
β Backup/Restore β Hours β Hours β
|
| 341 |
+
β Warm Standby β Minutes β Minutes β
|
| 342 |
+
β Hot Standby β Seconds β Seconds β
|
| 343 |
+
β Active-Active β Zero β Zero β
|
| 344 |
+
ββββββββββββββββββ΄βββββββββββββ΄βββββββββββββββ
|
| 345 |
+
```
|
| 346 |
+
|
| 347 |
+
---
|
| 348 |
+
|
| 349 |
+
## π¬ Labs
|
| 350 |
+
|
| 351 |
+
- [`lab-09-knowledge-graph.py`](lab-09-knowledge-graph.py) β Knowledge Graph cho Olist
|
| 352 |
+
- [`lab-09-vector-search.py`](lab-09-vector-search.py) β Vector Search & pgvector
|
| 353 |
+
- [`lab-09-blockchain-audit.py`](lab-09-blockchain-audit.py) β Blockchain Audit Trail
|
| 354 |
+
- [`lab-09-federated-query.py`](lab-09-federated-query.py) β Federated Querying
|
| 355 |
+
|
| 356 |
+
---
|
| 357 |
+
|
| 358 |
+
## π CΓ’u hα»i Γ΄n tαΊp
|
| 359 |
+
|
| 360 |
+
1. Polyglot Persistence lΓ gΓ¬? Cho 4 vΓ dα»₯ database type phΓΉ hợp cho 4 use case khΓ‘c nhau trong Olist.
|
| 361 |
+
2. Knowledge Graph biα»u diα»
n dα»― liα»u Olist nhΖ° thαΊΏ nΓ o? ViαΊΏt 2 Cypher queries.
|
| 362 |
+
3. So sΓ‘nh 4 phΖ°Ζ‘ng phΓ‘p Vector Indexing (Flat, IVF, HNSW, PQ).
|
| 363 |
+
4. Blockchain ΔαΊ£m bαΊ£o data integrity nhΖ° thαΊΏ nΓ o? GiαΊ£i thΓch hash chain.
|
| 364 |
+
5. Federated Query cΓ³ Ζ°u Δiα»m gΓ¬? Trade-off lΓ gΓ¬?
|