Re: background triggers?

From: Terry Lee Tucker <terry(at)esc1(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: background triggers?
Date: 2006-05-23 14:49:51
Message-ID: 200605231049.51032.terry@esc1.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 23 May 2006 11:19 am, Sim Zacks <sim(at)compulab(dot)co(dot)il> thus
communicated:
--> Is there any way to write a statement trigger that runs in the
--> background? In my testing, when I have an After Insert For Each
--> Statement trigger, the function call does not end until the trigger is
--> finished processing.
-->
--> What I would like to do, and please let me know if there is a better way
--> to do this, is to have an after event statement trigger run in a
--> separate process so the function call ends when it ends and the
--> statement trigger gets executed on its own time.
-->
--> The use that I have for this at the moment, and I can think of many
--> other uses, is that I want to populate a statistics table each time that
--> a table is updated. But the code to populate the table takes 10 seconds
--> to run. I don't want the user to have to wait 10 seconds to add a record.
-->
--> ---------------------------(end of broadcast)---------------------------
--> TIP 6: explain analyze is your friend
-->

How about notice processing. See Asynchronous Notification in the docs. You
can have your trigger make the notification and you can process execute the
statistics function when the notice arrives and you could even do it in the
background.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message venu Vempati 2006-05-23 15:03:14 password reset
Previous Message Sim Zacks 2006-05-23 14:19:56 functions and plans