Re: [COMMITTERS] pgsql: Use LEFT JOINs in some system views in case referenced row doesn

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Use LEFT JOINs in some system views in case referenced row doesn
Date: 2016-09-09 17:51:41
Message-ID: CAHGQGwH=o-DjJcnCryeXES3wnq-YLTJoF3rxr0qxqm0=2QJxuw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Sat, Aug 20, 2016 at 6:13 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Use LEFT JOINs in some system views in case referenced row doesn't exist.
>
> In particular, left join to pg_authid so that rows in pg_stat_activity
> don't disappear if the session's owning user has been dropped.
> Also convert a few joins to pg_database to left joins, in the same spirit,
> though that case might be harder to hit. We were doing this in other
> views already, so it was a bit inconsistent that these views didn't.

This change causes pg_stat_activity to report the "bogus" information about
walsenders as follows.

$ ps aux | grep 75076
postgres 75076 0.0 0.0 2608252 1364 ?? Ss 2:41AM
0:00.07 postgres: wal sender process postgres [local] streaming
0/3000140

=# SELECT * FROM pg_stat_activity;
-[ RECORD 1 ]----+--------------------------------
datid | 0
datname | (null)
pid | 75076
usesysid | 10
usename | postgres
application_name | sby1
client_addr | (null)
client_hostname | (null)
client_port | -1
backend_start | 2016-09-10 02:41:24.568313+09
xact_start | (null)
query_start | (null)
state_change | 2016-09-10 02:41:24.570135+09
wait_event_type | (null)
wait_event | (null)
state | idle
backend_xid | (null)
backend_xmin | (null)
query |

I think that this information is confusing and should not exist in
pg_stat_activity.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-09-09 17:59:24 Re: Re: [COMMITTERS] pgsql: Use LEFT JOINs in some system views in case referenced row doesn
Previous Message Tom Lane 2016-09-09 16:21:22 pgsql: In PageIndexTupleDelete, don't assume stored item lengths are MA

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-09-09 17:59:24 Re: Re: [COMMITTERS] pgsql: Use LEFT JOINs in some system views in case referenced row doesn
Previous Message Peter Geoghegan 2016-09-09 17:22:38 Re: Tuplesort merge pre-reading