Re: time penalties on triggers? - Mailing list pgsql-general

From Scott Marlowe
Subject Re: time penalties on triggers?
Date
Msg-id dcc563d10710041409kba8d9a7n3fc315238c0ea305@mail.gmail.com
Whole thread Raw
In response to time penalties on triggers?  ("Jan Theodore Galkowski" <bayesianlogic@acm.org>)
List pgsql-general
On 10/4/07, Jan Theodore Galkowski <bayesianlogic@acm.org> wrote:
> Does anyone know, or can anyone point to information about how much
> triggers penalize inserts in PG tables?  I'm getting a report that it is
> substantial, and before I investigate more.

Using your DDL, with slight variations, I came up with this:

create table ttest2 (i serial, lasttouched timestamp);
\timing
 first test with no primary key and no now():
Time: 414.226 ms
-- now with primary key:
Time: 1180.121 ms
-- No pk, with now:
Time: 792.013 ms
-- pk and now():
1240.343 ms

-- Now with a trigger, primary key, and of course now() from the trigger:
4823.051 ms

The basic rule of thumb is that if you need fast triggers, you write them in C.

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Large Result and Memory Limit
Next
From: Tom Lane
Date:
Subject: Re: ERROR: variable not found in subplan target lists