On Fri, Oct 18, 2019 at 11:18 AM Олег Самойлов <splarv@xxxxx> 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 important negative 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