1

What does it mean when a query state is null?

my_database_name> SELECT pid, datname, usename, application_name, query_start, state, state_change FROM pg_stat_activity;
+-------+------------------+------------------+--------------------------+-------------------------------+---------+-------------------------------+
| pid   | datname          | usename          | application_name         | query_start                   | state   | state_change                  |
|-------+------------------+------------------+--------------------------+-------------------------------+---------+-------------------------------|
| 19093 | my_database_name | my_user_nam      | pgcli                    | 2020-02-07 12:58:54.665447+00 | active  | 2020-02-07 12:58:54.665449+00 |
| 13777 | my_database_name | some_other_user  | DBeaver 6.3.2 - Main     | <null>                        | <null>  | <null>                        |
| 13776 | my_database_name | some_other_user  | DBeaver 6.3.2 - Metadata | <null>                        | <null>  | <null>                        |
| 2036  | <null>           | <null>           |                          | <null>                        | <null>  | <null>                        |
+-------+------------------+------------------+--------------------------+-------------------------------+---------+-------------------------------+
2

It means that the session with pid 2036 belongs to a different user, and you don't have the privileges to see that data.

Consider that the queries run in that session might contain data that you have no right to see.

You must either be a superuser or (in recent versions) be a member of the pg_read_all_stats role to see these data.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.