pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Praveen <praveen.k@renaissance-it.com>
Cc: pgsql-performance@postgresql.org
Cc: andreas.kretschmer@schollglas.com
Subject: Re: Trigger is not firing immediately
Date: Mon, 14 Jul 2008 11:33:46 +0200
Message-ID: <162867790807140233y56d53436pf194f6e38228052e@mail.gmail.com> (raw)
In-Reply-To: <010901c8e581$a2b85370$274610ac@praveenkm>
References: <010901c8e581$a2b85370$274610ac@praveenkm>

hello

Are you sure, so you don't call trigger recursion?

Regards
Pavel Stehule

2008/7/14 Praveen <praveen.k@renaissance-it.com>:
>
> Hi all,
>   Please find the procedure and trigger which took more time when we try to
> update value in table through Procedure.
>
> CREATE OR REPLACE FUNCTION procname1(args)
>  RETURNS void AS
> $BODY$
> DECLARE
> {
> ---
> Some code blocks
> ---
> }
> BEGIN
>
> -->      to here it is executing fastly after reaches this statement it's
> taking  time
>
>
> update table1 set col1 = val1 where pk = val2 and col2 = val3;
>
>
> -----> HERE table1  IS HAVING THE TRIGGER I GIVEN BELOW THE TRIGGER(
> trigger1)
>
>
> exception
> WHEN OTHERS
>  THEN
>  raise notice '''EXCEPTION IN procname1 BLOCK 3 : %''',SQLERRM;
>  NULL;
> END; $BODY$
> LANGUAGE 'plpgsql' VOLATILE;
> ALTER FUNCTION procname1(args);
>
>
>
>
> CREATE OR REPLACE FUNCTION trigger1()
>  RETURNS "trigger" AS
> $BODY$
> BEGIN
>
> IF (TG_OP='UPDATE') THEN
> IF( some condition )
>  THEN
>  BEGIN
>   INSERT INTO table2(cols)
>   VALUES(values);
>  IF NOT FOUND THEN
>  NULL;
>  END IF;
>  EXCEPTION
>   WHEN OTHERS
>  THEN
>  NULL;
>  END;
>  END IF;
> END IF;
> RETURN NULL;
> END; $BODY$
>  LANGUAGE 'plpgsql' VOLATILE;
> ALTER FUNCTION trigger1();
>
>
>> ----- Original Message ----- From: "A. Kretschmer"
>> <andreas.kretschmer@schollglas.com>
>> To: <pgsql-performance@postgresql.org>
>> Sent: Monday, July 14, 2008 12:18 PM
>> Subject: Re: [PERFORM] Trigger is not firing immediately
>>
>>
>>> am  Mon, dem 14.07.2008, um 12:04:49 +0530 mailte Praveen folgendes:
>>>>
>>>> Hi All,
>>>>    I am having a trigger in table, If I update the the table manually
>>>> trigger
>>>> is firing immediately(say 200ms per row), But if I update the table
>>>> through
>>>> procedure the trigger is taking time to fire(say 7 to 10 seconds per
>>>> row).
>>>>
>>>> Please tell me what kind of changes can I make so that  trigger  fire
>>>> immediately while updating the table through procedure ?
>>>
>>> Show us more details like source-code of the procedure, the trigger and
>>> a demonstration.
>>>
>>>
>>> Andreas
>>> --
>>> Andreas Kretschmer
>>> Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
>>> GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net
>>>
>>> --
>>> Sent via pgsql-performance mailing list
>>> (pgsql-performance@postgresql.org)
>>> To make changes to your subscription:
>>> http://www.postgresql.org/mailpref/pgsql-performance
>>>
>>
>>
>>
>
>
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
>



view thread (6+ messages)  latest in thread

Message-ID: <162867790807140233y56d53436pf194f6e38228052e@mail.gmail.com>
Permalink:  ../162867790807140233y56d53436pf194f6e38228052e@mail.gmail.com/
Also on:    postgresql.org/message-id/162867790807140233y56d53436pf194f6e38228052e@mail.gmail.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: pavel.stehule@gmail.com, praveen.k@renaissance-it.com, andreas.kretschmer@schollglas.com
  Subject: Re: Trigger is not firing immediately
  In-Reply-To: <162867790807140233y56d53436pf194f6e38228052e@mail.gmail.com>
  References: <010901c8e581$a2b85370$274610ac@praveenkm> <162867790807140233y56d53436pf194f6e38228052e@mail.gmail.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