| From: | Dimitri Fontaine <dfontaine(at)hi-media(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Trigger with WHEN clause (WIP) |
| Date: | 2009-10-15 21:43:48 |
| Message-ID: | m21vl4e3jf.fsf@hi-media.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kevin Grittner | 2009-10-15 21:54:06 | Re: Trigger with WHEN clause (WIP) |
| Previous Message | Tom Lane | 2009-10-15 21:40:34 | Re: inefficient use of relation extension? |