Re: UPDATE many records

Поиск
Список
Период
Сортировка
От Michael Lewis
Тема Re: UPDATE many records
Дата
Msg-id CAHOFxGoLdeWT8ed5pmVEM6QsSQDFPyFkmyEaV1Nt6bNvQ4yYMg@mail.gmail.com
обсуждение исходный текст
Ответ на RE: UPDATE many records  (Mark Zellers <markz@adaptiveinsights.com>)
Список pgsql-general
On Mon, Jan 6, 2020 at 2:34 PM Mark Zellers <markz@adaptiveinsights.com> wrote:

Just out of curiosity, what kind of trigger are you using, a row level trigger or a statement level trigger?  If you are using a row level trigger, see if you can achieve your requirements using a statement level trigger instead.  I’m relatively new to Postgres, so there could be some limit that I’m not aware of, but my understanding is that you have access to the old and new values of the updated rows in the after statement trigger.  It would likely be much more performant to do your operation once after the statement is done rather than firing a trigger on every changed row.


My experience/understanding is that statement level triggers can be a big performance boost, but only for changing *other* tables and not the table that the trigger is on since it is *AFTER* only and can't modify NEW record directly.

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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: jsonb_set() strictness considered harmful to data
Следующее
От: Justin
Дата:
Сообщение: Re: UPDATE many records