Re: time penalties on triggers?

From: Kenneth Downs <ken(at)secdat(dot)com>
To: bayesianlogic(at)acm(dot)org
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: time penalties on triggers?
Date: 2007-10-05 13:10:23
Message-ID: 470637BF.6070801@secdat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Josh Tolley 2007-10-05 13:56:51 Re: Design Question (Time Series Data)
Previous Message Michael Glaesemann 2007-10-05 12:40:17 Re: Find min year and min value