On 11/03/2016 17:55, Robert Haas wrote:
> On Fri, Mar 11, 2016 at 11:33 AM, Tomas Vondra
> <tomas.von...@2ndquadrant.com> wrote:
>> A bit late, but I think we should rename the GUC variable to
>> "sampling_rate" (instead of sample_ratio) as that's what pgbench uses
>> for the same thing. That'd be more consistent.
> 
> I like that idea.  It seems like slightly better terminology.
> 

I like it too. I also just noticed that I duplicated the var type by
mistake in the documentation :/

Attached patch fixes both.

-- 
Julien Rouhaud
http://dalibo.com - http://dalibo.org
diff --git a/contrib/auto_explain/auto_explain.c 
b/contrib/auto_explain/auto_explain.c
index 76d1831..55529af 100644
--- a/contrib/auto_explain/auto_explain.c
+++ b/contrib/auto_explain/auto_explain.c
@@ -29,7 +29,7 @@ static bool auto_explain_log_triggers = false;
 static bool auto_explain_log_timing = true;
 static int     auto_explain_log_format = EXPLAIN_FORMAT_TEXT;
 static bool auto_explain_log_nested_statements = false;
-static double auto_explain_sample_ratio = 1;
+static double auto_explain_sample_rate = 1;
 
 static const struct config_enum_entry format_options[] = {
        {"text", EXPLAIN_FORMAT_TEXT, false},
@@ -163,10 +163,10 @@ _PG_init(void)
                                                         NULL,
                                                         NULL);
 
-       DefineCustomRealVariable("auto_explain.sample_ratio",
+       DefineCustomRealVariable("auto_explain.sample_rate",
                                                         "Fraction of queries 
to process.",
                                                        NULL,
-                                                       
&auto_explain_sample_ratio,
+                                                       
&auto_explain_sample_rate,
                                                        1.0,
                                                        0.0,
                                                        1.0,
@@ -209,11 +209,11 @@ static void
 explain_ExecutorStart(QueryDesc *queryDesc, int eflags)
 {
        /*
-        * For ratio sampling, randomly choose top-level statement. Either
+        * For rate sampling, randomly choose top-level statement. Either
         * all nested statements will be explained or none will.
         */
        if (auto_explain_log_min_duration >= 0 && nesting_level == 0)
-               current_query_sampled = (random() < auto_explain_sample_ratio *
+               current_query_sampled = (random() < auto_explain_sample_rate *
                                MAX_RANDOM_VALUE);
 
        if (auto_explain_enabled() && current_query_sampled)
diff --git a/doc/src/sgml/auto-explain.sgml b/doc/src/sgml/auto-explain.sgml
index 6f1bde0..38e6f50 100644
--- a/doc/src/sgml/auto-explain.sgml
+++ b/doc/src/sgml/auto-explain.sgml
@@ -206,18 +206,17 @@ LOAD 'auto_explain';
 
    <varlistentry>
     <term>
-     <varname>auto_explain.sample_ratio</varname> (<type>real</type>)
+     <varname>auto_explain.sample_rate</varname> (<type>real</type>)
      <indexterm>
-      <primary><varname>auto_explain.sample_ratio</> configuration 
parameter</primary>
+      <primary><varname>auto_explain.sample_rate</> configuration 
parameter</primary>
      </indexterm>
     </term>
     <listitem>
      <para>
-      <varname>auto_explain.sample_ratio</varname> (<type>floating 
point</type>)
-      causes auto_explain to only explain a fraction of the statements in each
-      session.  The default is 1, meaning explain all the queries.  In case
-      of nested statements, either all will be explained or none. Only
-      superusers can change this setting.
+      <varname>auto_explain.sample_rate</varname> causes auto_explain to only
+      explain a fraction of the statements in each session.  The default is 1,
+      meaning explain all the queries.  In case of nested statements, either 
all
+      will be explained or none. Only superusers can change this setting.
      </para>
     </listitem>
    </varlistentry>
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to