pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pginfo <pginfo@t1.unisoftbg.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Trigger performance
Date: Thu, 22 Jan 2004 16:31:34 +0100
Message-ID: <400FECD6.B835AF9C@t1.unisoftbg.com> (raw)
References: <400F9955.3C0FD784@t1.unisoftbg.com>
	<12241.1074785874@sss.pgh.pa.us>

Hi,

thanks for the answer.
It is very interest, because I readet many times that if I write the trigger
in "C" it will work faster.
In wich case will this trigger work faster if write it in "C"?
In all my triggres I have "select ...." or "insert into mytable select ..."
or "update mytable set ...where...".
I need this info because I have a table with ~1.5 M rows and if I start to
update 300 K from this rows it takes ~ 2h.
If I remove the trigger for this table all the time is ~ 1 min.

regards,
ivan.

Tom Lane wrote:

> pginfo <pginfo@t1.unisoftbg.com> writes:
> > I was supprised that the pgsql trigger take ~8 sec. to insert this rows
> > and the "C" trigger take ~ 17 sec.
>
> The reason is that plpgsql caches the plan for the invoked SELECT,
> whereas the way you coded the C function, it's re-planning that SELECT
> on every call.
>
>                         regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)






view thread (6+ messages)  latest in thread

Message-ID: <400FECD6.B835AF9C@t1.unisoftbg.com>
Permalink:  ../400FECD6.B835AF9C@t1.unisoftbg.com/
Also on:    postgresql.org/message-id/400FECD6.B835AF9C@t1.unisoftbg.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: pginfo@t1.unisoftbg.com, tgl@sss.pgh.pa.us
  Subject: Re: Trigger performance
  In-Reply-To: <400FECD6.B835AF9C@t1.unisoftbg.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox