Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCBcM-0007zz-4S for pgsql-performance@arkaria.postgresql.org; Tue, 07 Nov 2017 21:41:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eCBcL-0002Qc-NU for pgsql-performance@arkaria.postgresql.org; Tue, 07 Nov 2017 21:41:09 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eCBaa-0006Nd-TL for pgsql-performance@postgresql.org; Tue, 07 Nov 2017 21:39:21 +0000 Received: from mail-lf0-x22c.google.com ([2a00:1450:4010:c07::22c]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1eCBaY-0005Qr-5e for pgsql-performance@postgresql.org; Tue, 07 Nov 2017 21:39:19 +0000 Received: by mail-lf0-x22c.google.com with SMTP id a2so737429lfh.11 for ; Tue, 07 Nov 2017 13:39:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=bpiVwbXMploPpYu2llaoSJ4i9xc+hY16Sc25dkSK7uU=; b=Yh8T0fO8CphEV8WH1ALom5LNNcyyC/rsU6iEy6ZT3r25zhbZb5Z7xW4J8gA9kpGUdi LSUx5YuE+JF9ktkS665R2BWTqwYMv48dD0B+rbj02NFnbl1PDzvFJ/s3yDddU+kwCJ/Z g+0J9SP+T4QgR4bFUfy1tWGteO9vxalB6dtX/gKdNWsAI+bl0bvjOFStZ5uEk8IPoHAG aygnKXFUjhBUWEAdyhWRxDmukmJFG9lS4YIhRvAfdl9/ktIacla2T9O/xHhsnUGtBJ8z /Pj7jXzrKdzuh/0VLSJDQaqqyySNJKarIpHlmSrPIu8zHWRdOAH+tXfZqEOkN6zHvSfP Y+tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=bpiVwbXMploPpYu2llaoSJ4i9xc+hY16Sc25dkSK7uU=; b=MkDx0ZzufGPujfQa23S/jc5nFzltXX0h48PoZIrOnszgUIVVJ+9oXGzWg4D+i6vF0Y FmLlvY9MxHLMtPVKgB3ht0vlhyufnt+1sz8aKu9hQZyHqt3LgFAk/pWokG6OnE4rTlR0 1jmotuCXmW8Iro2fNe7qkwQFu5qULva0V1HY/SLw3kRSJJFOe5D2DcsZRd3TITTfbJgt RNE/u6AJYebtV9AvefBYn9a/PY0ifw2lgX/qIHu/GaAZKc1iu1m3vfLKGTxhdOwKgUhy VZ0+DsD7UzYmRyXXNixstAJgcS+lM4W6SxjLl7SlR1QivIm+guYiJnpbbXzJvOa5sWwC X9og== X-Gm-Message-State: AJaThX4IJNItSYClb2+4UVXc91MH9z1eD5HL4iTngy6spIa5tRb+LEw3 2VsWZR+CHaGxrsGDjkcOQIdGbw+96Lq3KvrkiGA= X-Google-Smtp-Source: AGs4zMa3C6wVaOhTnJC9r8nl4j92uEd7SYh0ZYjAYEzvLBGeMyi7i4c5wEksGenSOLVxU2q0ifgpgDQXaOZoXDNR9vA= X-Received: by 10.25.26.76 with SMTP id a73mr50229lfa.250.1510090756327; Tue, 07 Nov 2017 13:39:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.195.85 with HTTP; Tue, 7 Nov 2017 13:39:15 -0800 (PST) In-Reply-To: References: <20171107151108.3jtmta4xrgmuyrqf@alap3.anarazel.de> <20171107194517.pabhi4czbtiasb2f@alap3.anarazel.de> From: Scott Marlowe Date: Tue, 7 Nov 2017 14:39:15 -0700 Message-ID: Subject: Re: Slow execution of SET ROLE, SET search_path and RESET ROLE To: =?UTF-8?Q?Ulf_Lohbr=C3=BCgge?= Cc: Andres Freund , "pgsql-performance@postgresql.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On Tue, Nov 7, 2017 at 2:25 PM, Ulf Lohbr=C3=BCgge wrote: > 2017-11-07 20:45 GMT+01:00 Andres Freund : >> >> On 2017-11-07 18:48:14 +0100, Ulf Lohbr=C3=BCgge wrote: >> > Hi, >> > >> > 2017-11-07 16:11 GMT+01:00 Andres Freund : >> > >> > > Hi, >> > > >> > > On 2017-11-07 11:11:36 +0100, Ulf Lohbr=C3=BCgge wrote: >> > > > I'm using PostgreSQL 9.5.9 on Debian and experience slow execution >> > > > of >> > > some >> > > > basic SET statements. >> > > > >> > > > I created about 1600 roles and use that setup for a multi tenancy >> > > > application: >> > > >> > > Hm. How often do you drop/create these roles? How many other >> > > roles/groups is one role a member of? >> > > >> > >> > I create between 10-40 roles per day. >> >> Could you VACUUM (VERBOSE, FREEZE) that table and report the output? Do >> you ever delete roles? > > > Which table do you mean exactly? pg_catalog.pg_authid? > > Sorry, forgot to write that: I delete about 2-3 roles per day. I'm gonna take a guess that pg_users or pg_roles has gotten bloated over time. Try running a vacuum full on both of them. It's also possible some other pg_xxx table is bloated out here too you might need to download something like checkpostgres.pl to check for bloat in system catalog tables. --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance