agora inbox for pgsql-performance@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ulf Lohbrügge <ulf.lohbruegge@gmail.com>
Cc: Scott Marlowe <scott.marlowe@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: [PERFORM] Slow execution of SET ROLE, SET search_path and RESET ROLE
Date: Thu, 07 Dec 2017 11:01:13 -0500
Message-ID: <6684.1512662473@sss.pgh.pa.us> (raw)
In-Reply-To: <CABZYQRJZp78vAJ2byse8AO75v-CWuj6qNdDmUtfMzRb+o7HX=g@mail.gmail.com>
References: <CABZYQRJZp78vAJ2byse8AO75v-CWuj6qNdDmUtfMzRb+o7HX=g@mail.gmail.com>

=?UTF-8?Q?Ulf_Lohbr=C3=BCgge?= <ulf.lohbruegge@gmail.com> writes:
> I could reproduce part of the things I described earlier in this thread. A
> guy named Andriy Senyshyn mailed me after reading this thread here (he
> could somehow not join the mailing list) and observed a difference when
> issuing "SET ROLE" as user postgres and as a non-superuser.

This isn't particularly surprising in itself.  When we know that the
session user is a superuser, SET ROLE just succeeds immediately.
Otherwise we have to determine whether the SET is allowed, ie, is
the session user a member of the specified role.

It looks like the first time such a question is asked within a session,
we build and cache a list of all the roles the session user is a member
of (directly or indirectly).  That's what's taking the time here ---
apparently in your test case, the "admin" role is a member of a whole lot
of roles?

			regards, tom lane




view thread (13+ messages)  latest in thread

Message-ID: <6684.1512662473@sss.pgh.pa.us>
Permalink:  ../6684.1512662473@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6684.1512662473@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ulf.lohbruegge@gmail.com, scott.marlowe@gmail.com, andres@anarazel.de
  Subject: Re: [PERFORM] Slow execution of SET ROLE, SET search_path and RESET ROLE
  In-Reply-To: <6684.1512662473@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox