Re: Trigger with WHEN clause (WIP) - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: Trigger with WHEN clause (WIP)
Date
Msg-id m21vl4e3jf.fsf@hi-media.com
Whole thread Raw
In response to Re: Trigger with WHEN clause (WIP)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Trigger with WHEN clause (WIP)
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:
> That argument is based on a completely evidence-free assumption, namely
> that this patch would make your case faster.  Executing the WHEN tests
> is hardly going to be zero cost.  It's not too hard to postulate cases
> where implementing a filter this way would be *slower* than doing it
> inside the trigger.

It's pretty often the case (IME) that calling a trigger is the only
point in the session where you fire plpgsql, and that's a visible
cost. Last time I had to measure it, it was 1ms per call. We were trying
to optimize queries running in 3ms to 4ms, called more than 100 times a
second (in parallel on multi core architecture, but still).

The way I understand it, having the WHEN clause in CREATE TRIGGER would
allow to filter out some interpreter initialisations.

Regards,
-- 
dim


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: inefficient use of relation extension?
Next
From: "Kevin Grittner"
Date:
Subject: Re: Trigger with WHEN clause (WIP)