Re: Remaining PDF layout issues

2020-05-11 Thread Tom Lane
I wrote:
>> Table 27.4 is annoying: it could be made to work, just barely, with some
>> hacking of the column widths and a  or two.  But it's not stable
>> text so I have little faith in the longevity of such a solution,
>> especially if people keep on inventing long wait event names.  I also
>> find it not very readable, even in a wide window.  The first idea that
>> comes to mind is to split it into multiple tables, one per "Wait Event
>> Type", so that we don't need the lefthand column.

Here's an attempt at doing it that way.  I think this might be a better
answer, although it's still subject to problems if anyone's logorrhea gets
any worse in naming wait conditions: "SerializablePredicateLockListLock"
is still going to force manually tweaking the column widths.

I sorted the names here, too.

regards, tom lane

diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index 579ccd3..64fc0e0 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -724,86 +724,15 @@ postgres   27093  0.0  0.0  30096  2752 ?Ss   11:34   0:00 postgres: ser
   wait_event_type
   text
   The type of event for which the backend is waiting, if any;
-   otherwise NULL. Possible values are:
-   
-
- 
-  LWLock: The backend is waiting for a lightweight lock.
-  Each such lock protects a particular data structure in shared memory.
-  wait_event will contain a name identifying the purpose
-  of the lightweight lock.  (Some locks have specific names; others
-  are part of a group of locks each with a similar purpose.)
- 
-
-
- 
-  Lock: The backend is waiting for a heavyweight lock.
-  Heavyweight locks, also known as lock manager locks or simply locks,
-  primarily protect SQL-visible objects such as tables.  However,
-  they are also used to ensure mutual exclusion for certain internal
-  operations such as relation extension.  wait_event will
-  identify the type of lock awaited.
- 
-
-
- 
-  BufferPin: The server process is waiting to access to
-  a data buffer during a period when no other process can be
-  examining that buffer.  Buffer pin waits can be protracted if
-  another process holds an open cursor which last read data from the
-  buffer in question.
- 
-
-
- 
-  Activity: The server process is idle.  This is used by
-  system processes waiting for activity in their main processing loop.
-  wait_event will identify the specific wait point.
- 
-
-
- 
-  Extension: The server process is waiting for activity
-  in an extension module.  This category is useful for modules to
-  track custom waiting points.
- 
-
-
- 
-  Client: The server process is waiting for some activity
-  on a socket from user applications, and that the server expects
-  something to happen that is independent from its internal processes.
-  wait_event will identify the specific wait point.
- 
-
-
- 
-  IPC: The server process is waiting for some activity
-  from another process in the server.  wait_event will
-  identify the specific wait point.
- 
-
-
- 
-  Timeout: The server process is waiting for a timeout
-  to expire.  wait_event will identify the specific wait
-  point.
- 
-
-
- 
-  IO: The server process is waiting for a IO to complete.
-  wait_event will identify the specific wait point.
- 
-
-   
+   otherwise NULL.  See .
   
  
 
  wait_event
  text
  Wait event name if backend is currently waiting, otherwise NULL.
- See  for details.
+  See  through
+  .
  
 
 
@@ -890,931 +819,1186 @@ postgres   27093  0.0  0.0  30096  2752 ?Ss   11:34   0:00 postgres: ser

   
 
-  
-   The pg_stat_activity view will have one row
-   per server process, showing information related to
-   the current activity of that process.
-  
+  
+   The pg_stat_activity view will have one row
+   per server process, showing information related to
+   the current activity of that process.
+  
+
+  
+   
+The wait_event and state columns are
+independent.  If a backend is in the active state,
+it may or may not be waiting on some event.  If the state
+is active and wait_event is non-null, it
+means that a query is being executed, but is being blocked somewhere
+in the system.
+   
+  
+
+  
+   Wait Event Types
+   
+
+ 
+  Wait Event Type
+  Description
+ 
+
+
+
+ 
+  Activity
+  The server 

Re: Remaining PDF layout issues

2020-05-11 Thread Tom Lane
I wrote:
> Table 27.4 is annoying: it could be made to work, just barely, with some
> hacking of the column widths and a  or two.  But it's not stable
> text so I have little faith in the longevity of such a solution,
> especially if people keep on inventing long wait event names.  I also
> find it not very readable, even in a wide window.  The first idea that
> comes to mind is to split it into multiple tables, one per "Wait Event
> Type", so that we don't need the lefthand column.  Another idea is to
> go over to a format similar to what I've proposed for catalog tables,
> with entries like

>   Timeout / BaseBackupThrottle
>   Descriptive text here ...
>   Timeout / RecoveryApplyDelay
>   Descriptive text here ...

Attached is a draft patch that does it the second way.  This looks
reasonably okay to me, although there's no denying that given a reasonably
wide window, the existing layout requires less vertical space.  But
I'm not sure that matters: I have come to the conclusion, after studying
this table, that nobody has ever yet looked at it.  If they had, we would
surely have gotten gripes about the fact that most of the entries are not
in anything resembling alphabetical order.  How in the world would anyone
look something up in this?  I have not changed the ordering in this patch,
but I think it would be a good idea to fix it to be rigidly alphabetical
(including the "type" part).

BTW, for the purposes of this patch I just abused the
func_table_entry/func_signature role values.  We could invent new ones,
but I'm not sure if it's worthwhile for just one table.

regards, tom lane

diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index 579ccd3..57d6716 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -909,912 +909,1794 @@ postgres   27093  0.0  0.0  30096  2752 ?Ss   11:34   0:00 postgres: ser
 
   
wait_event Description
+
+ 
+  
+   
+Wait Event Type / Wait Event Name
+   
+   
+Description
+   
+  
+ 
 
-
-  
-   
-Wait Event Type
-Wait Event Name
-Description
-   
-  
-
-  
-   
-LWLock
-ShmemIndexLock
-Waiting to find or allocate space in shared memory.
-   
-   
-OidGenLock
-Waiting to allocate or assign an OID.
-   
-
- XidGenLock
- Waiting to allocate or assign a transaction id.
-
-
- ProcArrayLock
- Waiting to get a snapshot or clearing a transaction id at
- transaction end.
-
-
- SInvalReadLock
- Waiting to retrieve or remove messages from shared invalidation
- queue.
-
-
- SInvalWriteLock
- Waiting to add a message in shared invalidation queue.
-
-
- WALBufMappingLock
- Waiting to replace a page in WAL buffers.
-
-
- WALWriteLock
- Waiting for WAL buffers to be written to disk.
-
-
- ControlFileLock
- Waiting to read or update the control file or creation of a
- new WAL file.
-
-
- CheckpointLock
- Waiting to perform checkpoint.
-
-
- CLogControlLock
- Waiting to read or update transaction status.
-
-
- SubtransControlLock
- Waiting to read or update sub-transaction information.
-
-
- MultiXactGenLock
- Waiting to read or update shared multixact state.
-
-
- MultiXactOffsetControlLock
- Waiting to read or update multixact offset mappings.
-
-
- MultiXactMemberControlLock
- Waiting to read or update multixact member mappings.
-
-
- RelCacheInitLock
- Waiting to read or write relation cache initialization
- file.
-
-
- CheckpointerCommLock
- Waiting to manage fsync requests.
-
-
- TwoPhaseStateLock
- Waiting to read or update the state of prepared transactions.
-
-
- TablespaceCreateLock
- Waiting to create or drop the tablespace.
-
-
- BtreeVacuumLock
-  Waiting to read or update vacuum-related information for a
-  B-tree index.
-
-
- AddinShmemInitLock
- Waiting to manage space allocation in shared memory.
-
-
- AutovacuumLock
- Autovacuum worker or launcher waiting to update or
- read the current state of autovacuum workers.
-
-
- AutovacuumScheduleLock
- Waiting to ensure that the table it has selected for a vacuum
- still needs vacuuming.
- 
-
-
- SyncScanLock
- Waiting to get