Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iLMUb-0006rP-On for pgsql-general@arkaria.postgresql.org; Fri, 18 Oct 2019 07:16:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iLMUa-0008Bn-78 for pgsql-general@arkaria.postgresql.org; Fri, 18 Oct 2019 07:16:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iLMUZ-0008Bc-PZ for pgsql-general@lists.postgresql.org; Fri, 18 Oct 2019 07:16:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iLMUT-0000Wb-9e for pgsql-general@lists.postgresql.org; Fri, 18 Oct 2019 07:16:06 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x9I7FwFG012451; Fri, 18 Oct 2019 03:15:59 -0400 From: Tom Lane To: =?utf-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= cc: "pgsql-generallists.postgresql.org" Subject: Re: stable for each row before insert trigger In-reply-to: <925B864A-0C60-4A2A-9072-88FB5501323F@ya.ru> References: <925B864A-0C60-4A2A-9072-88FB5501323F@ya.ru> Comments: In-reply-to =?utf-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= message dated "Fri, 18 Oct 2019 02:31:12 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27661.1571382958.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 18 Oct 2019 09:15:58 +0200 Message-ID: <27662.1571382958@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =3D?utf-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg=3D=3D?=3D wr= ites: > According to documentation the words "VOLATILE, STABLE, IMMUTABLE" is so= mehow useful with trigger functions, for instance mentioned that the AFTER= INSERT trigger should be VOLATILE. The question is how this words affect = a for each row before insert trigger? Can be some optimisation here? Where did you read that? There's no optimization that considers the volatility of trigger functions --- they'll be called exactly when specified, no more or less. There are some PLs that might behave differently depending on whether they think the function is volatile or not, but that's independent of whether the function is a trigger. regards, tom lane