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 1gHac9-0004as-Jm for pgsql-performance@arkaria.postgresql.org; Tue, 30 Oct 2018 20:27:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gHac7-0004ai-R6 for pgsql-performance@arkaria.postgresql.org; Tue, 30 Oct 2018 20:27:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHac7-0004aa-Ft for pgsql-performance@lists.postgresql.org; Tue, 30 Oct 2018 20:27:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHac5-00019S-4t for pgsql-performance@postgresql.org; Tue, 30 Oct 2018 20:27:46 +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 w9UKRhcB017064; Tue, 30 Oct 2018 16:27:43 -0400 From: Tom Lane To: =?UTF-8?Q?Ulf_Lohbr=C3=BCgge?= cc: pgsql-performance@postgresql.org Subject: Re: High CPU Usage of "SET ROLE" In-reply-to: References: <82967.1540216668@sss.pgh.pa.us> Comments: In-reply-to =?UTF-8?Q?Ulf_Lohbr=C3=BCgge?= message dated "Tue, 30 Oct 2018 20:49:32 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17062.1540931263.1@sss.pgh.pa.us> Date: Tue, 30 Oct 2018 16:27:43 -0400 Message-ID: <17063.1540931263@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =?UTF-8?Q?Ulf_Lohbr=C3=BCgge?= writes: > I think I have found something here. It looks like that the order of > statements is affecting their duration. I somehow have the feeling that the > first statement after "RESET ROLE;" experiences a performance degradation. Hm. It's well known that the first query executed in a *session* takes a pretty big performance hit, because of the need to populate the backend's catalog caches. I'm not very sure however why "RESET ROLE" would result in a mass cache flush, if indeed that's what's happening. regards, tom lane