Permalink
Browse files

Change the sl_log_* selection query from using a complicated where cl…

…ause

into a series of UNION ALL queries with slightly simpler qualifications.
The PostgreSQL optimizer failed on the old query to apply a lower bound
on the index scankey, causing the query to always select from the beginning
of the table. With a large backlog this caused significant time to be lost,
visible as "time to first row". The new query delivers the first log row
usually within milliseconds regardless of the size of sl_log_*.

New feature explain_interval.
This new slon.conf variable defines an interval in seconds at which the
remote worker will output the current log selection query together with
it's EXPLAIN query plan.
  • Loading branch information...
1 parent 6f60815 commit cfdf5c511e390775fdeb43dc37b07dffc61a3b20 Jan Wieck committed Dec 7, 2010
Showing with 459 additions and 161 deletions.
  1. +14 −0 doc/adminguide/slonconf.sgml
  2. +7 −1 share/slon.conf-sample
  3. +13 −0 src/slon/confoptions.c
  4. +424 −160 src/slon/remote_worker.c
  5. +1 −0 src/slon/slon.h
@@ -136,6 +136,20 @@
<varlistentry id="slon-config-logging-log-timestamp-format" xreflabel="slon_conf_log_timestamp_format">
<term><varname>log_timestamp_format</varname> (<type>string</type>)</term>
+ <indexterm>
+ <primary><varname>explain_interval</varname> configuration parameter</primary>
+ </indexterm>
+ <listitem>
+ <para>An interval in seconds at which the remote worker thread will
+ output the query, used to select log rows from the data provider, together
+ with it's EXPLAIN query plan. The default value of 0 turns this feature off.
+ The allowed range is 0 (off) to 86400 (once per day).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="slon-config-logging-explain-interval" xreflabel="slon_conf_explain_interval">
+ <term><varname>explain_interval</varname> (<type>integer</type>)</term>
<indexterm>
<primary><varname>log_timestamp_format</varname> configuration parameter</primary>
</indexterm>
View
@@ -68,6 +68,12 @@
# Default is '%Y-%m-%d %H:%M:%S %Z'
#log_timestamp_format='%Y-%m-%d %H:%M:%S %Z'
+# An interval in seconds at which the remote worker will output the
+# query used to select log rows together with it's query plan. The
+# default value of 0 turns this feature off.
+# Range: [0-86400], default: 0
+#explain_interval=0
+
# Where to write the pid file. Default: no pid file
#pid_file='/path/to/your/pidfile'
@@ -108,4 +114,4 @@
# lag_interval="8 minutes"
# Directory in which to stow sync archive files
-# archive_dir="/tmp/somewhere"
+# archive_dir="/tmp/somewhere"
View
@@ -723,6 +723,19 @@ static struct config_int ConfigureNamesInt[] =
30000 /* max val */
},
+ {
+ {
+ (const char *) "explain_interval", /* conf name */
+ gettext_noop("Interval in seconds in which the remote worker will report an explain of the log selection query"), /* short desc */
+ gettext_noop("Interval in seconds in which the remote worker will report an explain of the log selection query"), /* long desc */
+ SLON_C_INT /* config type */
+ },
+ &explain_interval, /* var name */
+ 0, /* default val (never) */
+ 0, /* min val */
+ 86400 /* max val (1 day) */
+ },
+
{{0}}
};
Oops, something went wrong.

0 comments on commit cfdf5c5

Please sign in to comment.