pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
detaching triggers
2+ messages / 2 participants
[nested] [flat]

* detaching triggers
@ 2005-03-27 15:41  Enrico Weigelt <weigelt@metux.de>
  0 siblings, 1 reply; 2+ messages in thread

From: Enrico Weigelt @ 2005-03-27 15:41 UTC (permalink / raw)
  To: pgsql-sql


Hi folks,

is it somehow possible to detach trigger, so the calling transaction
can return immediately, even before the trigger function has 
returned. 

I've got to do some quite complex things which may need some time, 
when some clients fill in some data, but the results are quite
uninteresting to these clients - its important that the client's 
query is finished as fast as possible.

The only solution I currently know is to fill somethings in a queue 
table by rule and have an external daemon looking at it every second.
But this doesnt seem very optimal for me.

Any better idea out these ?


thx
-- 
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux IT service

  phone:     +49 36207 519931         www:       http://www.metux.de/
  fax:       +49 36207 519932         email:     contact@metux.de
  cellphone: +49 174 7066481
---------------------------------------------------------------------
 -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops --
---------------------------------------------------------------------



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: detaching triggers
@ 2005-03-27 16:20  Mike Rylander <mrylander@gmail.com>
  parent: Enrico Weigelt <weigelt@metux.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Mike Rylander @ 2005-03-27 16:20 UTC (permalink / raw)
  To: weigelt@metux.de; +Cc: pgsql-sql

On Sun, 27 Mar 2005 17:41:02 +0200, Enrico Weigelt <weigelt@metux.de> wrote:
> 
> Hi folks,
> 
> is it somehow possible to detach trigger, so the calling transaction
> can return immediately, even before the trigger function has
> returned.

No, but see below.

> The only solution I currently know is to fill somethings in a queue
> table by rule and have an external daemon looking at it every second.
> But this doesnt seem very optimal for me.

Take a look at the LISTEN/NOTIFY interfaces in the docs.  This will
allow async post-transaction processing.  You can set up an ALSO rule
to notify when a particular type of statement has executed against
your target table.

http://www.postgresql.org/docs/8.0/static/sql-listen.html
http://www.postgresql.org/docs/8.0/static/sql-notify.html

See the bottom of:
http://www.postgresql.org/docs/8.0/static/sql-createrule.html

Hope that helps!

-- 
Mike Rylander
mrylander@gmail.com
GPLS -- PINES Development
Database Developer
http://open-ils.org



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-03-27 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-27 15:41 detaching triggers Enrico Weigelt <weigelt@metux.de>
2005-03-27 16:20 ` Mike Rylander <mrylander@gmail.com>

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