Re: Skip trigger?

From: Stephen Cook <sclists(at)gmail(dot)com>
To: wolfgang(at)alle-noten(dot)de, pgsql-general(at)postgresql(dot)org
Subject: Re: Skip trigger?
Date: 2016-05-01 02:04:19
Message-ID: 534ee067-18b7-f85e-ef4d-1f42ec255974@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2016-04-30 02:08, wolfgang(at)alle-noten(dot)de wrote:
> Hi,
>
> I have a table with a row update trigger that is quite slow.
> The trigger finction basically sets some bits in a "changed" column
> depending on which values really changed.
> For some bulk updates it can be determined in advance that the
> trigger function will not have any effect.
> Is there any way to run an update query and specify that it should not
> activate the trigger.
> I know that I can disable the trigger and reenable it later;
> however other concurrent updates mights need it

I always disable the trigger, run the update, and enable the trigger
within a transaction. This locks the table and will prevent other
sessions from doing updates without the trigger (I run it during
off-hours if it is going to take more time than is acceptable).

-- Stephen

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Hodder 2016-05-01 02:35:44 intermittent issue with windows 7 service manager not able to correctly determine or control postgresql 9.4
Previous Message Jeff Mcdowell 2016-04-30 19:03:02 Re: Vacuum of large tables causing replication delays to hot standby