Re: time penalties on triggers?

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: bayesianlogic(at)acm(dot)org
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: time penalties on triggers?
Date: 2007-10-04 21:09:44
Message-ID: dcc563d10710041409kba8d9a7n3fc315238c0ea305@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/4/07, Jan Theodore Galkowski <bayesianlogic(at)acm(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2007-10-04 21:10:25 Re: Large Result and Memory Limit
Previous Message Bill Moran 2007-10-04 21:03:48 Re: Large Result and Memory Limit