What is Trigger-Based Replication?

The replication process typically is implemented by the database system. No application code required. ✅ (Many cases that is what we want)

Although.. in some circumstances replication can been needed to perform:

  • Replication of a subset of data
  • Replication to one kind of database to another
  • Conflict resolution

You may ay require moving replication to the application layer such as toolset:

  • Oracle GoldenGate
    • This can make data changes available to an application by reading the database log 🕵️‍♂️

Alternative, features that are available in many RDBMS:

  • Triggers
  • Stored procedures

What are Triggers?

These will let you register custom application code that is automatically executed when a data change (write transaction) occurs in a database system.

  • A trigger has the opportunity to log this change into a separate table
    • That can be read from external process
    • 🤔 That external process can then apply the necessary application logic and replicate the data change to another system
      • 👉 Postgres from Bucardo works like this for example
Cons of trigger based replication
  • 👎 Typically has greater overheads than other applications methods
  • 👎 More prone to bugs and limitation than built in replication

📚 Further Reading & Related Topics

If you’re exploring replication strategies in distributed systems, these related articles will provide additional insights into data consistency and conflict resolution:

• Distributed Data-Intensive Systems: Logical Log Replication – Learn how logical logs help maintain consistency in distributed databases and complement trigger-based replication strategies.

• Resolving Write Conflicts in Distributed Data-Intensive Systems – Understand different techniques for managing conflicts that arise in replicated environments, ensuring data integrity across distributed nodes.

Leave a comment

I’m Sean

Welcome to the Scalable Human blog. Just a software engineer writing about algo trading, AI, and books. I learn in public, use AI tools extensively, and share what works. Educational purposes only – not financial advice.

Let’s connect