From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | ulf(dot)lohbruegge(at)gmail(dot)com |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-performa(dot)" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: High CPU Usage of "SET ROLE" |
Date: | 2018-10-30 22:34:28 |
Message-ID: | CAMkU=1yVpjOQamy3U3R+TdeBwcmgqPYQ5XwH4MfX5BZA=CFWyg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Tue, Oct 30, 2018 at 3:50 PM Ulf Lohbrügge <ulf(dot)lohbruegge(at)gmail(dot)com>
wrote:
> When I use the psql cli on the same database I can see via "\timing" that
> the first statement after "RESET ROLE;" is significantly slower. I was even
> able to strip it down to two statements ("SET ROLE ...;" and "RESET ROLE;"):
>
> ...
>
Maybe my observations here are already sufficient to find out what happens
> here? I guess that my setup with 1k rows in pg_roles and 1.5m rows in
> pg_class is probably the cause.
>
It would probably be enough if it were reproducible, but I can't reproduce
it.
-- set up
perl -le 'print "create user foo$_;" foreach 1..1000'|psql
perl -le 'foreach $r (1..1000) {print "create schema foo$r authorization
foo$r;"}'|psql
perl -le 'foreach $r (reverse 1..1000) {print "set role foo$r;"; print
"create table foo$r.foo$_ (x serial primary key);" foreach 1..1000;}'|psql
> out
-- test
perl -le 'print "set role foo$_;\nreset role;" foreach 1..1000'|psql
Does it help when I create a test setup with a docker image that contains a
> database with that many entries in pg_roles and pg_class and share it here?
>
If you have a script to create the database, I'd be more likely to play
around with that than with a docker image. (Which I have to guess would be
quite large anyway, with 1.5 rows in pg_class)
Cheers,
Jeff
>
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2018-10-31 09:55:01 | Re: SCRAM question |
Previous Message | Tom Lane | 2018-10-30 20:27:43 | Re: High CPU Usage of "SET ROLE" |