Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fC0tg-0007fq-6b for pgsql-general@arkaria.postgresql.org; Fri, 27 Apr 2018 10:46:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fC0te-0002P1-UA for pgsql-general@arkaria.postgresql.org; Fri, 27 Apr 2018 10:46:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fC0te-0002Or-Ld for pgsql-general@lists.postgresql.org; Fri, 27 Apr 2018 10:46:34 +0000 Received: from forward4p.cmail.yandex.net ([77.88.31.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fC0tc-0000Yd-Ke for pgsql-general@lists.postgresql.org; Fri, 27 Apr 2018 10:46:34 +0000 Received: from mxback7g.mail.yandex.net (mxback7g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:168]) by forward4p.cmail.yandex.net (Yandex) with ESMTP id B92EA2101A for ; Fri, 27 Apr 2018 13:46:30 +0300 (MSK) Received: from localhost (localhost [::1]) by mxback7g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id UAObheiU0x-kTRax8Qx; Fri, 27 Apr 2018 13:46:29 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ya.ru; s=mail; t=1524825989; bh=ktRpun+fboRVJvQgwdurHhnjv62n5Q152ZUFRn8ktSE=; h=From:To:References:Subject:Message-Id:Date; b=hpFvY2MHtOqUPe0TePTB2vICOQUmT+jkzA52eGF/6zDsJjUfsbpR9gXZiTJJu7fqz ssnDb7HnrFQI+cduf48ZtzkWpx3HBSv4deyVD0zGY0V1qOd18LBM7oNUO8ZylkjUFY 3GB2gIjWnFRgBe1vZazfWvZpOA1stT5gWGJn7eFQ= Authentication-Results: mxback7g.mail.yandex.net; dkim=pass header.i=@ya.ru Received: by web45j.yandex.ru with HTTP; Fri, 27 Apr 2018 13:46:29 +0300 From: Olleg Samoylov Envelope-From: splarv@yandex.ru To: "pgsql-general@lists.postgresql.org" References: Subject: Re: Asynchronous Trigger? MIME-Version: 1.0 Message-Id: <8172161524825989@web45j.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Fri, 27 Apr 2018 13:46:29 +0300 Content-Transfer-Encoding: 7bit Content-Type: text/html List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk
Try to look at PGQ from SkyTools.

On 2018-03-30 01:29, Cory Tucker wrote:
Is it possible to have the execution of a trigger (or any function) not block the completion of the statement they are associated with?

A pattern I had hoped to implement was to do a quick update of rows that signaled they needed attention, and then an async per-row trigger would come and do the maintenance (in this case, make an expensive materialized view).

Any suggestions welcome.

thanks!
--Cory