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 1j3l3D-00031R-Ex for pgsql-performance@arkaria.postgresql.org; Mon, 17 Feb 2020 18:23:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j3l3C-0003Mt-3n for pgsql-performance@arkaria.postgresql.org; Mon, 17 Feb 2020 18:23:22 +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 1j3l3B-0003Je-Nl for pgsql-performance@lists.postgresql.org; Mon, 17 Feb 2020 18:23:21 +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 1j3l39-0008ND-Co for pgsql-performance@lists.postgresql.org; Mon, 17 Feb 2020 18:23:20 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 01HING8Y009909; Mon, 17 Feb 2020 13:23:16 -0500 From: Tom Lane To: Pavel Stehule cc: Laurenz Albe , Lars Aksel Opsahl , "pgsql-performance@lists.postgresql.org" Subject: Re: SubtransControlLock and performance problems In-reply-to: References: <61eeb178848bdc2e0dd6c81ce94f3ace7c1348ff.camel@cybertec.at> Comments: In-reply-to Pavel Stehule message dated "Mon, 17 Feb 2020 19:01:11 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <9907.1581963796.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 17 Feb 2020 13:23:16 -0500 Message-ID: <9908.1581963796@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Pavel Stehule writes: > po 17. 2. 2020 v 17:36 odesílatel Laurenz Albe > napsal: >> Either use shorter transactions, or start fewer subtransactions. > it is interesting topic, but I don't see it in my example > CREATE OR REPLACE FUNCTION public.fx(integer) > RETURNS void > LANGUAGE plpgsql > AS $function$ > begin > for i in 1..$1 loop > begin > --raise notice 'xx'; > exception when others then > raise notice 'yyy'; > end; > end loop; > end; > $function$ This example doesn't create or modify any table rows within the subtransactions, so (I think) we won't assign XIDs to them. It's consumption of subtransaction XIDs that causes the issue. regards, tom lane