Re: Why are stored procedures looked on so negatively?

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: Why are stored procedures looked on so negatively?
Дата
Msg-id A737B7A37273E048B164557ADEF4A58B17BF0B56@ntex2010a.host.magwien.gv.at
обсуждение исходный текст
Ответ на Re: Why are stored procedures looked on so negatively?  (Some Developer <someukdeveloper@gmail.com>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Some Developer
Дата:
Сообщение: Re: Why are stored procedures looked on so negatively?
Следующее
От: Amit Langote
Дата:
Сообщение: Re: [HACKERS] maintenance_work_mem and CREATE INDEX time