PostgreSQL 10.0 preview feature enhancement - dynamic view pg_stat_activity adds database management process information

Keywords: PostgreSQL git Database github

Label

PostgreSQL, 10.0, pg_stat_activity, management process, background process, work process, parallel computing process

background

PostgreSQL is a process model. Some management processes will be fork at startup and after startup, and the user's service process will be generated when the user connects.

for example

1. Posmaster, responsible for monitoring

2. startup process, responsible for recovery

3. logger, responsible for writing logs

4. shared buffer writer, responsible for cleaning dirty pages and persistent data files through LRU algorithm

5. wal buffer writer, responsible for writing WAL to WAL log files

6. checkpointer, responsible for checkpoint tasks

7. stats process, responsible for collecting statistics, updating counter counts (query consumption statistics, table insertion records, updating records, deletion records, deadtuple, etc.).

8. autovacuum launcher, responsible for monitoring the age of tables, garbage proportion, waking up vacuum worker to collect garbage when touching threshold, updating the statistical information of tables (pg_stats for carrying out planned cost calculation).

9. autovacuum worker, the working process of automatic garbage collection.

10. Parallel computing worker process, when performing parallel computing tasks.

11. Walsender, as an upstream node, replicates the message sending process.

12. wal receiver, as the downstream node, replicates the message receiving process.

13. Other worker process es, other plug-in development processes.

14. user backend process, user process.

In previous versions, the database management process will not be displayed. 10.0 extends the function of pg_stat_activity view, adds a process type field, and all process information will be displayed.

It is convenient for administrators to observe the running status of the database.

+    <row>  
+     <entry><structfield>backend_type</structfield></entry>  
+     <entry><type>text</type></entry>  
+     <entry>Type of current backend. Possible types are   
+      <literal>autovacuum launcher</>, <literal>autovacuum worker</>,  
+      <literal>background worker</>, <literal>background writer</>,  
+      <literal>client backend</>, <literal>checkpointer</>,  
+      <literal>startup</>, <literal>walreceiver</>,  
+      <literal>walsender</> and <literal>walwriter</>.  
+     </entry>  
+    </row>  

patch information is as follows

Show more processes in pg_stat_activity.  
  
Previously, auxiliary processes and background workers not connected  
to a database (such as the logical replication launcher) weren't  
shown.  Include them, so that we can see the associated wait state  
information.  Add a new column to identify the processes type, so that  
people can filter them out easily using SQL if they wish.  
  
Before this patch was written, there was discussion about whether we  
should expose this information in a separate view, so as to avoid  
contaminating pg_stat_activity with things people might not want to  
see.  But putting everything in pg_stat_activity was a more popular  
choice, so that's what the patch does.  
  
Kuntal Ghosh, reviewed by Amit Langote and Michael Paquier.  Some  
revisions and bug fixes by me.  
  
Discussion: http://postgr.es/m/CA+TgmoYES5nhkEGw9nZXU8_FhA8XEm8NTm3-SO+3ML1B81Hkww@mail.gmail.com         

For this discussion of patch, see Mail Group, URL at the end of this article.

PostgreSQL community style is very rigorous, a patch may be discussed in the mail group for several months or even years, according to your opinion repeated amendments, patch merged into master is very mature, so the stability of PostgreSQL is well known.

Reference resources

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=fc70a4b0df38bda6a13941f1581f25fbb643c7f3

Posted by melody on Thu, 20 Dec 2018 05:15:05 -0800