Some Developer wrote:
> On 24/07/13 01:55, John Meyer wrote:
> > Taking an absolutist position either way is pretty blind. What is the
> > purpose of the procedure? Is it enforcing business rules? Are these
> > rules that must be enforced against already existing data or are they
> > more akin to validation of a credit card. How many people are accessing
> > your database at one time? And most importantly, what are you best at?
>
> Basically what happens is an object is created in the application and
> saved to the database. When the insert has completed I need to start a
> process immediately based on the information in the object on another
> server (Amazon Simple Message Queue to be precise).
>
> So basically I'll have a trigger function that fires on INSERTs and does
> this work. That way the action will only be performed on INSERTs that
> have successfully completed and I can be sure that the trigger will
> always fire.
If you want to write a (trigger) function that starts a process on
a remote machine, there are a few points to think about:
- Should the INSERT fail if the remote process cannot be started?
If yes, then a trigger is a good idea.
- If you code it as a trigger, be aware that the transaction
is not complete until the remote process has been started.
That might be a noticable delay and might affect concurrency
negatively.
Yours,
Laurenz Albe