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

From Kenneth Downs
Subject Re: time penalties on triggers?
Date
Msg-id 470637BF.6070801@secdat.com
Whole thread Raw
In response to time penalties on triggers?  ("Jan Theodore Galkowski" <bayesianlogic@acm.org>)
Responses Re: time penalties on triggers?  (Vivek Khera <vivek@khera.org>)
List pgsql-general
Jan Theodore Galkowski 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.  The triggers in question
> look like:
>

I use triggers everywhere.  About a year ago I did some very simple
tests, 1000's of inserts to tables, then 1000s of inserts to the same
tables with all triggers disabled.

What I found was that the largest factor in performance was the size of
the row being inserted.  This makes sense since Postgres uses MVCC.

I also found it very hard to pin down the penalty of the trigger, but
came up with rough figures of 30-50% overhead.  The complexity of the
trigger did not matter.

This all made sense based on the fact that writing to disk takes
infinitely more time than processing trigger code, so the penalty seems
to come into play as overhead in firing the trigger.





--
Kenneth Downs
Secure Data Software, Inc.
www.secdat.com    www.andromeda-project.org
631-689-7200   Fax: 631-689-0527
cell: 631-379-0010


pgsql-general by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: Find min year and min value
Next
From: "Josh Tolley"
Date:
Subject: Re: Design Question (Time Series Data)