PeterVandivier
The [docs on `pg_stat_activity`][1] tell us that `datname` is the...
> Name of the database this backend is connected to
I can currently see a number of records where `datname` is NULL. How have these mischievous workers connected to my database service without the virtue of a database context?
<>https://dbfiddle.uk/?rdbms=postgres_12&fiddle=0b5caff2253bf750f4ebf501e470c373
If I had superuser permissions, I might be able to see that these workers have a `backend_type` something like...
- autovacuum launcher
- logical replication launcher
- background writer
- checkpointer
- walwriter
![Screenshot 2020-10-21 at 11.56.15.png](/image?hash=09677f039d9cfc2d57ed2973f18cbda1caf0de0d101a53f191c5e3e1c4f9d639)
From the [source code][2], I can hazard a guess that [`pgstat_fetch_stat_local_beentry`][3] is bailing trying to define the backend context for these workers. But the fact that I'm trying to read C code means I've probably failed at more elementary googling.
Halp me, TA; you're my only hope...
[1]: https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW
[2]: https://github.com/postgres/postgres/blob/11a68e4b53ffccf336a2faf5fa380acda28e880b/src/backend/utils/adt/pgstatfuncs.c#L568
[3]: https://github.com/postgres/postgres/blob/e7591fd3cae6c64236ef29d3c87e69b96608a19b/src/backend/postmaster/pgstat.c#L2608