Greetings, * Robert Haas (robertmh...@gmail.com) wrote: > On Mon, Nov 4, 2019 at 8:26 AM Alvaro Herrera <alvhe...@2ndquadrant.com> > 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? > > 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
signature.asc
Description: PGP signature