Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc70a4b

Browse files
committed
Show more processes in pg_stat_activity.
Previously, auxiliary processes and background workers not connectedto a database (such as the logical replication launcher) weren'tshown. Include them, so that we can see the associated wait stateinformation. Add a new column to identify the processes type, so thatpeople can filter them out easily using SQL if they wish.Before this patch was written, there was discussion about whether weshould expose this information in a separate view, so as to avoidcontaminating pg_stat_activity with things people might not want tosee. But putting everything in pg_stat_activity was a more popularchoice, so that's what the patch does.Kuntal Ghosh, reviewed by Amit Langote and Michael Paquier. Somerevisions and bug fixes by me.Discussion:http://postgr.es/m/CA+TgmoYES5nhkEGw9nZXU8_FhA8XEm8NTm3-SO+3ML1B81Hkww@mail.gmail.com
1 parent2f0903e commitfc70a4b

File tree

14 files changed

+305
-53
lines changed

14 files changed

+305
-53
lines changed

‎doc/src/sgml/monitoring.sgml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
620620
<row>
621621
<entry><structfield>backend_start</></entry>
622622
<entry><type>timestamp with time zone</></entry>
623-
<entry>Time when this process was started, i.e., when the
624-
client connected to the server
623+
<entry>Time when this process was started. For client backends,
624+
this is the time theclient connected to the server.
625625
</entry>
626626
</row>
627627
<row>
@@ -797,6 +797,17 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
797797
<xref linkend="guc-track-activity-query-size">.
798798
</entry>
799799
</row>
800+
<row>
801+
<entry><structfield>backend_type</structfield></entry>
802+
<entry><type>text</type></entry>
803+
<entry>Type of current backend. Possible types are
804+
<literal>autovacuum launcher</>, <literal>autovacuum worker</>,
805+
<literal>background worker</>, <literal>background writer</>,
806+
<literal>client backend</>, <literal>checkpointer</>,
807+
<literal>startup</>, <literal>walreceiver</>,
808+
<literal>walsender</> and <literal>walwriter</>.
809+
</entry>
810+
</row>
800811
</tbody>
801812
</tgroup>
802813
</table>

‎src/backend/bootstrap/bootstrap.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,10 @@ AuxiliaryProcessMain(int argc, char *argv[])
387387
/* finish setting up bufmgr.c */
388388
InitBufferPoolBackend();
389389

390+
/* Initialize backend status information */
391+
pgstat_initialize();
392+
pgstat_bestart();
393+
390394
/* register a before-shutdown callback for LWLock cleanup */
391395
before_shmem_exit(ShutdownAuxiliaryProcess,0);
392396
}

‎src/backend/catalog/system_views.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,8 @@ CREATE VIEW pg_stat_activity AS
716716
S.state,
717717
S.backend_xid,
718718
s.backend_xmin,
719-
S.query
719+
S.query,
720+
S.backend_type
720721
FROM pg_stat_get_activity(NULL)AS S
721722
LEFT JOIN pg_databaseAS DON (S.datid=D.oid)
722723
LEFT JOIN pg_authidAS UON (S.usesysid=U.oid);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp