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

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

I wrote:
> Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
>> 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.

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

> Hmm ... but if we want to exclude walsenders from that view, surely we
> should do so explicitly, not have it happen as a hidden side-effect
> of not being able to join them to pg_database.

I looked into this a little. There are at least three things we could
do here:

1. Decide that showing walsenders is a good thing. I'm not really
sure why it isn't -- for example, we could take the trouble to display
the current replication command as the walsender's activity.

2. Suppress walsenders by the expedient of ignoring PGPROCs that have
zero database ID. This would also ignore other process types that aren't
connected to a specific database. This is pretty backwards-compatible
because it's equivalent to what used to happen implicitly via the inner
join in the view.

3. Suppress walsenders by adding some new field to PgBackendStatus that
identifies them, and having pg_stat_get_activity() use that to filter.

It looks to me like even before the change Fujii-san complains of, it was
only generic walsenders that were hidden in the view. Database-specific
walsenders (am_db_walsender) would have a valid database OID in
PgBackendStatus and therefore would pass the join. This makes me think
that option #1 is really the sanest alternative. While option #2 is
the most backwards-compatible, it's pretty hard to see why we would think
that showing only database-specific walsenders is a desirable behavior.
If we want to exclude walsenders altogether, we need option #3.

Thoughts?

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-09-10 17:49:16 pgsql: Fix miserable coding in pg_stat_get_activity().
Previous Message Amit Kapila 2016-09-10 11:32:21 Re: Re: [COMMITTERS] pgsql: Change the way that LWLocks for extensions are allocated.

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2016-09-10 18:10:51 Re: Parallel tuplesort (for parallel B-Tree index creation)
Previous Message Tom Lane 2016-09-10 16:03:19 Re: Useless dependency assumption libxml2 -> libxslt in MSVC scripts