TGViewer
Data science/ML/AI Data science/ML/AI @datascience_bds · 14.1K subscribers
Post #961 1.61K
🚀 Databricks Tip: REPLACE vs MERGE

When updating Delta tables, you’ve got two powerful options:

🔹 REPLACE TABLE … ON
📚 Like throwing away the entire library and rebuilding it.
- Drops the old table & recreates it.
- Schema + data = fully replaced.
- ⚡ Super fast but destructive (old data gone).
- ✅ Best for full refreshes or schema changes.

🔹 MERGE
📖 Like updating only the books that changed.
- Works row by row.
- Updates, inserts, or deletes specific records.
- 🔍 Preserves unchanged data.
- ✅ Best for incremental updates or CDC (Change Data Capture).

⚖️ Key Difference
- REPLACE = Start fresh with a new table.
- MERGE = Surgically update rows without losing the rest.

👉 Rule of thumb:
Use REPLACE for full rebuilds,
Use MERGE for incremental upserts.

#Databricks #DeltaLake
  • ❤ 6
More from @datascience_bds
  1. Oct 17, 2026document post
  2. Oct 15, 2026Computer Vision Explained
  3. Oct 13, 20261,000 AI/ML Acronyms & Operational Concepts
  4. Oct 12, 2026Roadmap to Learn SQL
  5. Oct 11, 2026🧮 Why does NumPy let you add a number to an entire matrix? Look at this: import numpy as…
  6. Oct 10, 2026document post
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →