Marginal comments and docs cleanup.
authorTom Lane
Tue, 10 Mar 2020 21:34:01 +0000 (17:34 -0400)
committerTom Lane
Tue, 10 Mar 2020 21:34:09 +0000 (17:34 -0400)
Fix up some imprecise comments and poor markup from ba79cb5dc.  Also try
to convert the documentation of log_min_duration_sample and friends into
passable English.

doc/src/sgml/config.sgml
src/backend/nodes/params.c
src/backend/utils/mb/stringinfo_mb.c

index c1128f89ec7707f614a4e3d440a6eb5838774b18..371d7838fb6473e87755633729e7843dfc5a8ed5 100644 (file)
@@ -5984,13 +5984,13 @@ local0.*    /var/log/postgresql
         
          Causes the duration of each completed statement to be logged
          if the statement ran for at least the specified amount of time.
-         If this value is specified without units, it is taken as milliseconds.
-         Setting this to zero prints all statement durations.
-         Minus-one (the default) disables logging statement durations.
          For example, if you set it to 250ms
          then all SQL statements that run 250ms or longer will be
          logged.  Enabling this parameter can be helpful in tracking down
          unoptimized queries in your applications.
+         If this value is specified without units, it is taken as milliseconds.
+         Setting this to zero prints all statement durations.
+         Minus-one (the default) disables logging statement durations.
          Only superusers can change this setting.
         
 
@@ -6030,49 +6030,39 @@ local0.*    /var/log/postgresql
       
        
         
-         Allows to sample the logging of the duration of each completed
-         statement if the statement ran for at least the specified amount of
-         time. If this value is specified without units, it is taken as milliseconds.
+         Allows sampling the duration of completed statements that ran for
+         at least the specified amount of time.  This produces the same
+         kind of log entries as
+         , but only for a
+         subset of the executed statements, with sample rate controlled by
+         .
+         For example, if you set it to 100ms then all
+         SQL statements that run 100ms or longer will be considered for
+         sampling.  Enabling this parameter can be helpful when the
+         traffic is too high to log all queries.
+         If this value is specified without units, it is taken as milliseconds.
          Setting this to zero samples all statement durations.
          Minus-one (the default) disables sampling statement durations.
-         For example, if you set it to 250ms
-         then all SQL statements that run 250ms or longer will be considered
-         for sampling, with sample rate is controlled by 
-         Enabling this parameter can be helpful when the traffic too high to
-         sample all queries.
          Only superusers can change this setting.
         
 
         
-         This option has lower priority than ,
-         meaning that statements with durations exceeding 
-         are not subject to sampling and are always logged.
-        
-
-        
-         For clients using extended query protocol, durations of the Parse,
-         Bind, and Execute steps are logged independently.
+         This setting has lower priority
+         than log_min_duration_statement, meaning that
+         statements with durations
+         exceeding log_min_duration_statement are not
+         subject to sampling and are always logged.
         
 
-       
         
-         When using this option together with
-         ,
-         the text of statements that are logged because of
-         log_statement will not be repeated in the
-         duration log message.
-         If you are not using syslog, it is recommended
-         that you log the PID or session ID using
-         
-         so that you can link the statement message to the later
-         duration message using the process ID or session ID.
+         Other notes for log_min_duration_statement
+         apply also to this setting.
         
-       
        
      
 
      
-      log_statement_sample_rate (real)
+      log_statement_sample_rate (floating point)
       
        log_statement_sample_rate configuration parameter
       
@@ -6080,43 +6070,40 @@ local0.*    /var/log/postgresql
        
         
          Determines the fraction of statements with duration exceeding
-          to be logged.
-         This is a statistical parameter, for example 0.5
-         means there is statistically one in two chances to log the statement.
-         The default is 1.0, meaning log all such
+          that will be logged.
+         Sampling is stochastic, for example 0.5 means
+         there is statistically one chance in two that any given statement
+         will be logged.
+         The default is 1.0, meaning to log all sampled
          statements.
-         Setting this to zero disables sampling logging, same as setting
+         Setting this to zero disables sampled statement-duration logging,
+         the same as setting
          log_min_duration_sample to
          -1.
-         log_statement_sample_rate is helpful when the
-         traffic is too high to log all queries.
          Only superusers can change this setting.
         
-       
-        
-         Like all statement-logging options, this option can add significant
-         overhead.
-        
-       
        
      
 
      
-      log_transaction_sample_rate (real)
+      log_transaction_sample_rate (floating point)
       
        log_transaction_sample_rate configuration parameter
       
       
        
         
-         Set the fraction of transactions whose statements are all logged,
+         Sets the fraction of transactions whose statements are all logged,
          in addition to statements logged for other reasons.  It applies to
          each new transaction regardless of its statements' durations.
-         The default is 0, meaning not to log statements
-         from any additional transaction.  Setting this to 1
-         logs all statements for all transactions.
-         log_transaction_sample_rate is helpful to track a
-         sample of transaction.
+         Sampling is stochastic, for example 0.1 means
+         there is statistically one chance in ten that any given transaction
+         will be logged.
+         log_transaction_sample_rate can be helpful to
+         construct a sample of transactions.
+         The default is 0, meaning not to log
+         statements from any additional transactions.  Setting this
+         to 1 logs all statements of all transactions.
          Only superusers can change this setting.
         
        
@@ -6632,9 +6619,9 @@ log_line_prefix = '%m [%p] %q%u@%d/%a '
        
         Controls whether bind parameters are logged when a statement is logged
         as a result of .
-        It adds some overhead, as postgres will compute and store textual
-        representations of parameter values in memory for all statements,
-        even if they eventually do not get logged.
+        It adds some overhead, as PostgreSQL will
+        compute and store textual representations of parameter values in
+        memory for all statements, even if they eventually do not get logged.
         This setting has no effect on statements logged due to
          or
          settings, as they are always logged
index b28ec3b6ce43a97c1f719b8b013a412d354d0286..a57f9eea768fb7bb5f9702ec69571866b1c79f34 100644 (file)
@@ -262,16 +262,16 @@ RestoreParamList(char **start_address)
 
 /*
  * BuildParamLogString
- *     Return a string that represent the parameter list, for logging.
+ *     Return a string that represents the parameter list, for logging.
  *
  * If caller already knows textual representations for some parameters, it can
  * pass an array of exactly params->numParams values as knownTextValues, which
  * can contain NULLs for any unknown individual values.  NULL can be given if
  * no parameters are known.
  *
- * If maxlen is not zero, that's the maximum number of characters of the
- * input string printed; an ellipsis is added if more characters exist.
- * (Added quotes are not considered.)
+ * If maxlen is not zero, that's the maximum number of bytes of any one
+ * parameter value to be printed; an ellipsis is added if the string is
+ * longer.  (Added quotes are not considered in this calculation.)
  */
 char *
 BuildParamLogString(ParamListInfo params, char **knownTextValues, int maxlen)
@@ -282,7 +282,8 @@ BuildParamLogString(ParamListInfo params, char **knownTextValues, int maxlen)
 
    /*
     * NB: think not of returning params->paramValuesStr!  It may have been
-    * generated with a different maxlen, and so unsuitable.
+    * generated with a different maxlen, and so be unsuitable.  Besides that,
+    * this is the function used to create that string.
     */
 
    /*
index c153b770076771779dbddca78a2fdd78f5d23039..791a667daea9a3ecde00a0089166c7978d4a7197 100644 (file)
@@ -26,7 +26,7 @@
 /*
  * appendStringInfoStringQuoted
  *
- * Append up to maxlen characters from s to str, or the whole input string if
+ * Append up to maxlen bytes from s to str, or the whole input string if
  * maxlen <= 0, adding single quotes around it and doubling all single quotes.
  * Add an ellipsis if the copy is incomplete.
  */