开发者

Are there better alternatives to db triggers?

开发者 https://www.devze.com 2023-04-09 07:28 出处:网络
I have two databases. I want to keep one table in sync. Let\'s call it the user table. When one row in a table change开发者_运维问答s using a trigger I need to update the second database and the other

I have two databases. I want to keep one table in sync. Let's call it the user table. When one row in a table change开发者_运维问答s using a trigger I need to update the second database and the other way around.

  • Is this safe?
  • Is there a better way to do this?

It's not a direct PHP/PostgreSQL question, but I am using them so a specific answer might help.


This works just fine going in one direction and in fact is the way the slony replication engine works. Going in both directions not so much. What you can do in slony is have two tables, one going in each direction, and a view on each end that the two tables into one cohesive view to the user.

0

精彩评论

暂无评论...
验证码 换一张
取 消