Re: Skip trigger?

From: Manuel Gómez <targen(at)gmail(dot)com>
To: wolfgang(at)alle-noten(dot)de
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Skip trigger?
Date: 2016-04-30 15:36:11
Message-ID: CAJWnFaPb1PZGL=9Wd1nwCmyRC6DKvLhSF_Xxox0=NMr2vpdRWA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Apr 30, 2016 at 1:38 AM, <wolfgang(at)alle-noten(dot)de> wrote:
> 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

Indeed the main issue is how you want to handle concurrency. ALTER
TABLE statements to disable triggers works and is transactional, but
locks the table, which may be undesired. Here are some useful
pointers: http://blog.endpoint.com/2015/07/selectively-firing-postgres-triggers.html

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2016-04-30 16:22:52 Why don't custom GUCs show in pg_settings?
Previous Message Peter Devoy 2016-04-30 15:17:22 Re: Skip trigger?