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.