Re: High CPU Usage of "SET ROLE"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ulf Lohbrügge <ulf(dot)lohbruegge(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: High CPU Usage of "SET ROLE"
Date: 2018-10-22 13:57:48
Message-ID: 82967.1540216668@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

=?UTF-8?Q?Ulf_Lohbr=C3=BCgge?= <ulf(dot)lohbruegge(at)gmail(dot)com> writes:
> I'm running PostgreSQL 9.6.10 on Debian and reported some performance
> issues with "SET ROLE" a while ago:
> https://www.postgresql.org/message-id/CABZYQR%2BKu%2BiLFhqwY89QrrnKG9wKxckmssDG2rYKESojiohRgQ%40mail.gmail.com
> ...
> The setup is the same as reported in the above mentioned post: I use more
> than a thousand roles per PostgreSQL instance and set the role for every
> connection before executing actual statements. My pg_class consists
> of 1,557,824 rows as every role has its own schema with more than 300
> tables.

It seems plausible to guess that you've hit some behavior that's O(N^2)
in the number of objects (for some object type or other). Perhaps "perf"
or a similar tool would give some insight into where the bottleneck is.

https://wiki.postgresql.org/wiki/Profiling_with_perf

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Erik Rijkers 2018-10-23 12:50:18 Re: [HACKERS] proposal: schema variables
Previous Message Ulf Lohbrügge 2018-10-22 13:44:16 High CPU Usage of "SET ROLE"