Re: Proposal to sync SET ROLE and pg_stat_activity - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Proposal to sync SET ROLE and pg_stat_activity
Date
Msg-id 20080828155341.GE8424@alvh.no-ip.org
Whole thread Raw
In response to Re: Proposal to sync SET ROLE and pg_stat_activity  (Grant Finnemore <grant@guruhut.com>)
Responses Re: Proposal to sync SET ROLE and pg_stat_activity  (Grant Finnemore <grant@guruhut.com>)
List pgsql-hackers
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).

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: September Commit Fest coming soon!
Next
From: Grant Finnemore
Date:
Subject: Re: Proposal to sync SET ROLE and pg_stat_activity