Re: stable for each row before insert trigger - Mailing list pgsql-general

From Luca Ferrari
Subject Re: stable for each row before insert trigger
Date
Msg-id CAKoxK+51uQ71w1mR9_Rqrg7Bw8rvt3f-Bt01qON=_MykievWTQ@mail.gmail.com
Whole thread Raw
In response to Re: stable for each row before insert trigger  (Олег Самойлов <splarv@ya.ru>)
List pgsql-general
On Fri, Oct 18, 2019 at 11:18 AM Олег Самойлов <splarv@ya.ru> wrote:
> > STABLE indicates .... (It is inappropriate for AFTER triggers that wish to query rows modified by the current
command.)
>
> So, STABLE is inappropriate for such trigger, but is appropriate for BEFORE trigger?
>

Well, a before trigger will not see data changes in any way, so I read
it as "it does not matter for before triggers".
And I would speculate that, being in a trigger, the function is
invoked every time, so there should not be any caching that produces
performance boosts.


> For instance, I expect that the FOR EACH ROW BEFORE trigger marked as STABLE will be faster than VOLATILE without
importantnegative side effects. I observed 3% benefit. IMMUTABLE trigger is slightly slower then STABLE, but I am not
sure,too low difference. 

It could be faster, but I would not speculate on that rather than an
inling of the code.

Luca



pgsql-general by date:

Previous
From: Guillaume Lelarge
Date:
Subject: Re: Execute a function through fdw
Next
From: David Steele
Date:
Subject: Re: Postgres Point in time Recovery (PITR),