Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7a8d874

Browse files
committed
Rename auto_explain.sample_ratio to sample_rate
Per suggestion from Tomas Vondra Author: Julien Rouhaud
1 parent a1aa8b7 commit 7a8d874

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

contrib/auto_explain/auto_explain.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static bool auto_explain_log_triggers = false;
2929
static bool auto_explain_log_timing = true;
3030
static int auto_explain_log_format = EXPLAIN_FORMAT_TEXT;
3131
static bool auto_explain_log_nested_statements = false;
32-
static double auto_explain_sample_ratio = 1;
32+
static double auto_explain_sample_rate = 1;
3333

3434
static const struct config_enum_entry format_options[] = {
3535
{"text", EXPLAIN_FORMAT_TEXT, false},
@@ -163,10 +163,10 @@ _PG_init(void)
163163
NULL,
164164
NULL);
165165

166-
DefineCustomRealVariable("auto_explain.sample_ratio",
166+
DefineCustomRealVariable("auto_explain.sample_rate",
167167
"Fraction of queries to process.",
168168
NULL,
169-
&auto_explain_sample_ratio,
169+
&auto_explain_sample_rate,
170170
1.0,
171171
0.0,
172172
1.0,
@@ -209,11 +209,11 @@ static void
209209
explain_ExecutorStart(QueryDesc *queryDesc, int eflags)
210210
{
211211
/*
212-
* For ratio sampling, randomly choose top-level statement. Either
212+
* For rate sampling, randomly choose top-level statement. Either
213213
* all nested statements will be explained or none will.
214214
*/
215215
if (auto_explain_log_min_duration >= 0 && nesting_level == 0)
216-
current_query_sampled = (random() < auto_explain_sample_ratio *
216+
current_query_sampled = (random() < auto_explain_sample_rate *
217217
MAX_RANDOM_VALUE);
218218

219219
if (auto_explain_enabled() && current_query_sampled)

doc/src/sgml/auto-explain.sgml

+6-7
Original file line numberDiff line numberDiff line change
@@ -206,18 +206,17 @@ LOAD 'auto_explain';
206206

207207
<varlistentry>
208208
<term>
209-
<varname>auto_explain.sample_ratio</varname> (<type>real</type>)
209+
<varname>auto_explain.sample_rate</varname> (<type>real</type>)
210210
<indexterm>
211-
<primary><varname>auto_explain.sample_ratio</> configuration parameter</primary>
211+
<primary><varname>auto_explain.sample_rate</> configuration parameter</primary>
212212
</indexterm>
213213
</term>
214214
<listitem>
215215
<para>
216-
<varname>auto_explain.sample_ratio</varname> (<type>floating point</type>)
217-
causes auto_explain to only explain a fraction of the statements in each
218-
session. The default is 1, meaning explain all the queries. In case
219-
of nested statements, either all will be explained or none. Only
220-
superusers can change this setting.
216+
<varname>auto_explain.sample_rate</varname> causes auto_explain to only
217+
explain a fraction of the statements in each session. The default is 1,
218+
meaning explain all the queries. In case of nested statements, either all
219+
will be explained or none. Only superusers can change this setting.
221220
</para>
222221
</listitem>
223222
</varlistentry>

0 commit comments

Comments
 (0)