Re: Proposal to sync SET ROLE and pg_stat_activity

From: Grant Finnemore <grant(at)guruhut(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Bernd Helmle <mailings(at)oopsware(dot)de>, Euler Taveira de Oliveira <euler(at)timbira(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal to sync SET ROLE and pg_stat_activity
Date: 2008-08-28 16:07:14
Message-ID: 48B6CD32.7080807@guruhut.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Alvaro,

Alvaro Herrera wrote:
> Grant Finnemore wrote:
>
>> Well, pg_stat_activity isn't really the problem here, because as you
>> point out, it's just a view, and I could certainly redefine the view.
>> The limiting factor is that the backend doesn't push the role name
>> changes to the stats subsystem for either SET ROLE or SET SESSION
>> AUTH.
>
> Keep in mind that stats are updated only once every 500 ms, and messages
> have a nontrivial overhead. With your proposed changes, there would be
> a significant performance overhead to running security definer
> functions.
>
> A possible solution to this would be to publish current_user in shared
> memory, so that remote processes could read it from there (similar to
> how current_query is published).
>
Yeah, I was concerned about security definer functions, although I
hadn't yet got round to benchmarking the effects.

If there is some consensus that from a user perspective this is a
reasonable enhancement, I'll pursue the changes using your suggestion of
the current_query approach.

Regards,
Grant

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Brendan Jurd 2008-08-28 16:39:10 Re: TODO <-> Commitfest
Previous Message Alvaro Herrera 2008-08-28 15:53:41 Re: Proposal to sync SET ROLE and pg_stat_activity