pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[BeginnerQuestion]Why these is 6 rows in my SELECT statement?
3+ messages / 3 participants
[nested] [flat]

* [BeginnerQuestion]Why these is 6 rows in my SELECT statement?
@ 2022-09-08 08:37  BeginnerC <chuxuec@outlook.com>
  0 siblings, 2 replies; 3+ messages in thread

From: BeginnerC @ 2022-09-08 08:37 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hello community,
I am checking my pg_stat_activity view,but something confused me.
Just like this:

postgres=# SELECT wait_event_type, wait_event FROM pg_stat_activity;
 wait_event_type |     wait_event
-----------------+---------------------
 Activity        | AutoVacuumMain
 Activity        | LogicalLauncherMain
                 |
 Activity        | BgWriterHibernate
 Activity        | CheckpointerMain
 Activity        | WalWriterMain
(6 rows)

As you can see, the third row is empty,but I don't know why.
Can anyone provide some solution to me?
Thanks in advance!

Yours,
BeginnerC.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [BeginnerQuestion]Why these is 6 rows in my SELECT statement?
@ 2022-09-08 09:02  Ian Lawrence Barwick <barwick@gmail.com>
  parent: BeginnerC <chuxuec@outlook.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Ian Lawrence Barwick @ 2022-09-08 09:02 UTC (permalink / raw)
  To: BeginnerC <chuxuec@outlook.com>; +Cc: pgsql-general@lists.postgresql.org

2022年9月8日(木) 17:37 BeginnerC <chuxuec@outlook.com>:
>
> Hello community,
> I am checking my pg_stat_activity view,but something confused me.
> Just like this:
>
> postgres=# SELECT wait_event_type, wait_event FROM pg_stat_activity;
>  wait_event_type |     wait_event
> -----------------+---------------------
>  Activity        | AutoVacuumMain
>  Activity        | LogicalLauncherMain
>                  |
>  Activity        | BgWriterHibernate
>  Activity        | CheckpointerMain
>  Activity        | WalWriterMain
> (6 rows)
>
> As you can see, the third row is empty,but I don't know why.
> Can anyone provide some solution to me?

It's empty because that's your own client session and it's not waiting
on anything :).

     postgres=# SELECT pg_backend_pid();
     pg_backend_pid
    ----------------
              24941
    (1 row)

   postgres=# SELECT pid, backend_type, wait_event_type, wait_event
FROM pg_stat_activity;
      pid  |         backend_type         | wait_event_type |
wait_event
    -------+------------------------------+-----------------+---------------------
     20859 | autovacuum launcher          | Activity        | AutoVacuumMain
     20860 | logical replication launcher | Activity        |
LogicalLauncherMain
     21554 | walsender                    | Activity        | WalSenderMain
     24941 | client backend               |                 |
     20856 | background writer            | Activity        | BgWriterHibernate
     20855 | checkpointer                 | Activity        | CheckpointerMain
     20858 | walwriter                    | Activity        | WalWriterMain
    (7 rows)

Regards

Ian Barwick





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [BeginnerQuestion]Why these is 6 rows in my SELECT statement?
@ 2022-09-08 12:41  hubert depesz lubaczewski <depesz@depesz.com>
  parent: BeginnerC <chuxuec@outlook.com>
  1 sibling, 0 replies; 3+ messages in thread

From: hubert depesz lubaczewski @ 2022-09-08 12:41 UTC (permalink / raw)
  To: BeginnerC <chuxuec@outlook.com>; +Cc: pgsql-general@lists.postgresql.org

On Thu, Sep 08, 2022 at 04:37:00PM +0800, BeginnerC wrote:
> Hello community,
> I am checking my pg_stat_activity view,but something confused me.
> Just like this:
> 
> postgres=# SELECT wait_event_type, wait_event FROM pg_stat_activity;
> wait_event_type |     wait_event
> -----------------+---------------------
> Activity        | AutoVacuumMain
> Activity        | LogicalLauncherMain
>                 |
> Activity        | BgWriterHibernate
> Activity        | CheckpointerMain
> Activity        | WalWriterMain
> (6 rows)
> 
> As you can see, the third row is empty,but I don't know why.
> Can anyone provide some solution to me?
> Thanks in advance!

Please do:

\pset null '-- null --'
SELECT wait_event_type, wait_event FROM pg_stat_activity;

it will most likely show -- null -- in these fields. which means values
in these columns are null.SELECT wait_event_type, wait_event FROM
pg_stat_activity;

You can find more about this/these backends by doing:

select * from pg_stat_activity where wait_event_type is null \gx

depesz





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-09-08 12:41 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08 08:37 [BeginnerQuestion]Why these is 6 rows in my SELECT statement? BeginnerC <chuxuec@outlook.com>
2022-09-08 09:02 ` Ian Lawrence Barwick <barwick@gmail.com>
2022-09-08 12:41 ` hubert depesz lubaczewski <depesz@depesz.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox