Re: Trigger that spawns forked process

From: Douglas McNaught <doug(at)mcnaught(dot)org>
To: Christopher Murtagh <christopher(dot)murtagh(at)mcgill(dot)ca>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Trigger that spawns forked process
Date: 2005-05-09 21:01:21
Message-ID: m2wtq85d26.fsf@Douglas-McNaughts-Powerbook.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Christopher Murtagh <christopher(dot)murtagh(at)mcgill(dot)ca> writes:

> No, I don't want the trigger to do any db stuff at all. Basically, I've
> got a content management system that is going to be split across a
> cluster. Upon an update submission from one of them, I want to replicate
> across the others (which can happen in pseudo real time). So, basically
> the DB is the master, once it makes an update, it will spawn a process
> to the syncronization (all of this code is written). I just don't want
> the initial update process to wait for replication to finish (which is
> only a second or two under normal load). I could write a daemon that
> would sit an listen to these replication requests, but that just seems
> to be more complex than I need.

Why not have a client connection LISTENing and doing the
synchronization, and have the trigger use NOTIFY?

Or, you could have the trigger write to a table, and have another
client periodically scanning the table for new sync events.

Either one of those would be simpler and more robust than fork()ing
inside the backend.

-Doug

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-05-09 21:07:02 Re: Trigger that spawns forked process
Previous Message Jaime Casanova 2005-05-09 20:32:27 Re: WHERE