public inbox for pgsql-performance@postgresql.org
help / color / mirror / Atom feedFrom: Ulf Lohbrügge <ulf.lohbruegge@gmail.com>
To: Scott Marlowe <scott.marlowe@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Slow execution of SET ROLE, SET search_path and RESET ROLE
Date: Wed, 8 Nov 2017 00:04:18 +0100
Message-ID: <CABZYQRKGG6AohYi8U9aX+=iYidyWxCn8ratkiiN7YytmFJESNw@mail.gmail.com> (raw)
In-Reply-To: <CAOR=d=3t=y4A+5+iuSaPWj9zgKNin=9rf9+jvR4TAB+g_tXMVA@mail.gmail.com>
References: <CABZYQR+Ku+iLFhqwY89QrrnKG9wKxckmssDG2rYKESojiohRgQ@mail.gmail.com>
<20171107151108.3jtmta4xrgmuyrqf@alap3.anarazel.de>
<CABZYQR+GE7mV7qiTFGO3EqxdqV_TmSQyzY3ghSE1OfHabZcG7g@mail.gmail.com>
<20171107194517.pabhi4czbtiasb2f@alap3.anarazel.de>
<CABZYQR+hepKxvDeMReZLcrYYmrhwFU3aX5qGG2QvDYT4V0wHDQ@mail.gmail.com>
<CAOR=d=3t=y4A+5+iuSaPWj9zgKNin=9rf9+jvR4TAB+g_tXMVA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
2017-11-07 22:39 GMT+01:00 Scott Marlowe <scott.marlowe@gmail.com>:
> On Tue, Nov 7, 2017 at 2:25 PM, Ulf Lohbrügge <ulf.lohbruegge@gmail.com>
> wrote:
> > 2017-11-07 20:45 GMT+01:00 Andres Freund <andres@anarazel.de>:
> >>
> >> On 2017-11-07 18:48:14 +0100, Ulf Lohbrügge wrote:
> >> > Hi,
> >> >
> >> > 2017-11-07 16:11 GMT+01:00 Andres Freund <andres@anarazel.de>:
> >> >
> >> > > Hi,
> >> > >
> >> > > On 2017-11-07 11:11:36 +0100, Ulf Lohbrügge 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.
>
As pg_user and pg_roles are views: Do you mean pg_authid? That table is
just 432kb large:
--snip--
postgres=# select pg_size_pretty(pg_total_relation_size('pg_authid'));
pg_size_pretty
----------------
432 kB
(1 row)
--snap--
I don't want to start a vacuum full right now because I'm not quite sure if
things will lock up. But I will do it later when there is less traffic.
I just ran "check_postgres.pl --action=bloat" and got the following output:
--snip--
POSTGRES_BLOAT OK: DB "postgres" (host:localhost) (db postgres) index
pg_shdepend_depender_index rows:? pages:9615 shouldbe:4073 (2.4X) wasted
bytes:45400064 (43 MB) | pg_shdepend_depender_index=45400064B
pg_catalog.pg_shdepend=9740288B pg_shdepend_reference_index=4046848B
pg_depend_reference_index=98304B pg_depend_depender_index=57344B
pg_catalog.pg_class=32768B pg_catalog.pg_description=16384B
pg_amop_fam_strat_index=8192B pg_amop_opr_fam_index=8192B
pg_catalog.pg_amop=8192B pg_catalog.pg_depend=8192B pg_class_oid_index=0B
pg_class_relname_nsp_index=0B pg_class_tblspc_relfilenode_index=0B
pg_description_o_c_o_index=0B
--snap--
Looks fine, doesn't it?
Cheers,
Ulf
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: ulf.lohbruegge@gmail.com, scott.marlowe@gmail.com, andres@anarazel.de
Subject: Re: Slow execution of SET ROLE, SET search_path and RESET ROLE
In-Reply-To: <CABZYQRKGG6AohYi8U9aX+=iYidyWxCn8ratkiiN7YytmFJESNw@mail.gmail.com>
* 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