MERGE/UPSERT: Next
Module: Data Modification & Transactions
INSERT Patterns: Learn bulk data insertion techniques for staging tables
UPDATE with Joins: Understand complex update patterns before UPSERT
DELETE & TRUNCATE: Complete data modification operations
Transaction Control (ACID): Ensure UPSERT atomicity and consistency
Indexing Strategies: Optimize UPSERT performance with proper indexes
ETL Pipelines: Apply UPSERT in data integration workflows
Idempotent Operations: Design systems that handle retries safely
Conflict Resolution: Advanced strategies for handling duplicates
Write PostgreSQL UPSERT to sync user profiles from API (handle new users and profile updates)
Implement MySQL atomic counter using UPSERT (page views, likes, votes)
Create SQL Server MERGE to sync customer data with insert/update/delete
Build bulk UPSERT pipeline: staging table → UPSERT → production (1M rows)
Implement conditional UPSERT: only update if source is newer than target
Write UPSERT with RETURNING/OUTPUT to track inserts vs updates
Create idempotent payment processing using UPSERT (handle duplicate events)
Implement product catalog sync with UPSERT (handle price/stock updates)
Build event counter using UPSERT (accumulate counts atomically)
Write UPSERT with composite key (user_id + content_id)
UPSERT vs separate INSERT/UPDATE: Performance, race conditions, code complexity
Database-specific syntax: PostgreSQL ON CONFLICT vs MySQL ON DUPLICATE KEY vs SQL Server MERGE
Idempotent operations: What makes UPSERT idempotent? Why important for ETL?
Conflict resolution: How does UPSERT detect conflicts? What about composite keys?
Performance optimization: Why index conflict columns? What is performance impact?
EXCLUDED vs VALUES(): How to reference proposed values in different databases?
Bulk UPSERT: How to process millions of rows efficiently? Staging table pattern?
Race conditions: How does UPSERT prevent race conditions? Compare to try-INSERT-catch-UPDATE
Conditional UPSERT: How to only update if certain conditions met? WHERE clause usage?
Real-world scenarios: Payment processing, product sync, viewing history - which UPSERT pattern?
PostgreSQL INSERT ON CONFLICT: https://www.postgresql.org/docs/current/sql-insert.html#SQL-ON-CONFLICT
MySQL INSERT ON DUPLICATE KEY: https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html
SQL Server MERGE: https://docs.microsoft.com/en-us/sql/t-sql/statements/merge-transact-sql
Oracle MERGE: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/MERGE.html
Idempotent Operations: Design patterns for retry-safe systems
ETL Best Practices: Using UPSERT in data integration pipelines
Database Performance: Indexing strategies for UPSERT operations
Conflict Resolution: Advanced strategies for handling duplicate data
Atomic Operations: Understanding database atomicity and ACID properties
Bulk Data Loading: Staging table patterns for high-volume UPSERT