Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iReru-0008Aq-Qh for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Nov 2019 16:06:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iRert-0000B1-KH for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Nov 2019 16:06:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iRert-0000Au-BY for pgsql-hackers@lists.postgresql.org; Mon, 04 Nov 2019 16:06:13 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iRero-0005rh-Bi for pgsql-hackers@lists.postgresql.org; Mon, 04 Nov 2019 16:06:12 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id E03465F998; Mon, 4 Nov 2019 11:06:05 -0500 (EST) Date: Mon, 4 Nov 2019 11:06:05 -0500 From: Stephen Frost To: Robert Haas Cc: Alvaro Herrera , PostgreSQL Hackers , Kuntal Ghosh Subject: Re: auxiliary processes in pg_stat_ssl Message-ID: <20191104160605.GC6962@tamriel.snowman.net> References: <20190904151535.GA29108@alvherre.pgsql> <20191104132559.GA18441@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="OzJS34+Ao05mLk2R" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --OzJS34+Ao05mLk2R Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Robert Haas (robertmhaas@gmail.com) wrote: > On Mon, Nov 4, 2019 at 8:26 AM Alvaro Herrera = wrote: > > On 2019-Sep-04, Alvaro Herrera wrote: > > > I just noticed that we list auxiliary processes in pg_stat_ssl: > > [...] > > > But this seems pointless. Should we not hide those? Seems this only > > > happened as an unintended side-effect of fc70a4b0df38. It appears to= me > > > that we should redefine that view to restrict backend_type that's > > > 'client backend' (maybe include 'wal receiver'/'wal sender' also, not > > > sure.) > > > > [crickets] > > > > Robert, Kuntal, any opinion on this? >=20 > I think if I were doing something about it, I'd probably try to filter > on a field that directly represents whether there is a connection, > rather than checking the backend type. That way, if the list of > backend types that have client connections changes later, there's > nothing to update. Like "WHERE client_port IS NOT NULL," or something > of that sort. Yeah, using a "this has a connection" would be better and, as also noted on this thread, pg_stat_gssapi should get similar treatment. Based on what we claim in our docs, it does look like 'client_port IS NOT NULL' should work. I do think we might want to update the docs to make it a bit more explicit, what we say now is: TCP port number that the client is using for communication with this backend, or -1 if a Unix socket is used We don't explain there that NULL means the backend doesn't have an external connection even though plenty of those entries show up in every instance of PG. Perhaps we should add this: If this field is null, it indicates that this is an internal process such as autovacuum. Which is what we say for 'client_addr'. I have to admit that while it's handy that we just shove '-1' into client_port when it's a unix socket, it's kind of ugly from a data perspective- in a green field it'd probably be better to have a "connection type" field that then indicates which other fields are valid instead of having a special constant, but that ship sailed long ago and it's not like we have a lot of people complaining about it, so I suppose just using it here as suggested is fine. Thanks, Stephen --OzJS34+Ao05mLk2R Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJdwExtAAoJEO1sijiDR2RVf9cQAI4q8QYYFDEbMRsjn56FXXdd 0kdbiHdeVbSnYJDHF6ZlLuRLf8gCw29SowR1rexU0qVRgYbuveDYCx4WwB03HE07 PDN3nLonmOOhH/4A9WtpNNh5HQH7M1dUq7coVJEHpQk5YpRDZq33FV3e/NBcUE6/ ZS0pOeEbZIpyJTFho5A9LBHhXwNk/a9adlzca10F5FtMKUQfMW8WqQP19aA60g6e tS6hEhRb/Nfpau9VAeQCkKKw6yWyybVxOlh1ZREAcsEVdIK1GCxhKr1jiduSQpbu XiK391vs4zBvMUxhsjgnjyd1WiBJvE1musmi7OWgKpTBkY91+4mkIy3GvzhueX1y KFzRTiQzPJMRrquLzVyLGxyaHiNKi1klnCCQ0gfoI4Q9w8RCBXp49KNgqfQ3GLOz 4jyR2tbwcs2cXj9LvgP6B9gTE3840nGNrfBABXUQBNu9hNcxVann9MFPUDO0upE1 atuHndnxOEuOA/jDV6/ZToUpPaDYWjtFpBIA2VbFAAhWggDuPIfDwko6bIvxu3VC 6uVBKA7VZeE8oTyQjQpKjW+Q22QTiCMB4V9wIoNd/NqQ17+eChqXSIZitMSUuAMZ RRZeKWDvXNV7WR6b56vqs0ZjdErQUUnbfuZ4IEh9ZO9/IQoh8y3fFUmQ626NDu5k CL1A+7ctc6aimuGuPG8m =FNCD -----END PGP SIGNATURE----- --OzJS34+Ao05mLk2R--