Help Needed: Alternatives to Triggers

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 求助,关于触发器的替代方案

| username: 很新的用户

[TiDB Usage Environment] Production Environment
[TiDB Version] 6.5
Seeking guidance from experts, migrating DB2 to TiDB, the original database used triggers, and as we all know, TiDB does not support triggers. Is there a good alternative solution for triggers?

| username: 啦啦啦啦啦 | Original post link

Currently, triggers, stored procedures, and user-defined functions are not supported. It seems there is no particularly good solution at the database level, so it can only be implemented using program code.

| username: xfworld | Original post link

It cannot be resolved at the database layer, but it can be addressed through other methods. The general directions are:

  1. Subscription Model
    Use TiCDC to achieve data change subscription. The subscribed events can be distributed or centrally consumed to meet downstream business logic.

  2. Internal Notification Model
    At the application layer, logical notifications can be implemented through internal frameworks based on service division to achieve business logic.

  3. Cascading Dependency Model
    Refer to the logic of distributed services and handle it in a strongly consistent manner…

The applicable scenarios, difficulty, and cost of the above methods vary, so please consider carefully.

| username: 很新的用户 | Original post link

Got it, thanks for the explanation.

| username: 很新的用户 | Original post link

This is the only way, thank you.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.