summaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/postgresql.conf.sample
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2019-11-04 01:57:45 +0100
committerTomas Vondra <tomas.vondra@postgresql.org>2019-11-06 19:11:07 +0100
commit6e3e6cc0e884a6091e1094dff29db430af08fb93 (patch)
treeb44e1702678389fc68ec9a2da2ff5bb21c4db9a5 /src/backend/utils/misc/postgresql.conf.sample
parent11d9ac28e5e0077d8f23761c2962a30423f44cee (diff)
Allow sampling of statements depending on duration
This allows logging a sample of statements, without incurring excessive log traffic (which may impact performance). This can be useful when analyzing workloads with lots of short queries. The sampling is configured using two new GUC parameters: * log_min_duration_sample - minimum required statement duration * log_statement_sample_rate - sample rate (0.0 - 1.0) Only statements with duration exceeding log_min_duration_sample are considered for sampling. To enable sampling, both those GUCs have to be set correctly. The existing log_min_duration_statement GUC has a higher priority, i.e. statements with duration exceeding log_min_duration_statement will be always logged, irrespectedly of how the sampling is configured. This means only configurations log_min_duration_sample < log_min_duration_statement do actually sample the statements, instead of logging everything. Author: Adrien Nayrat Reviewed-by: David Rowley, Vik Fearing, Tomas Vondra Discussion: https://postgr.es/m/bbe0a1a8-a8f7-3be2-155a-888e661cc06c@anayrat.info
Diffstat (limited to 'src/backend/utils/misc/postgresql.conf.sample')
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 0fc23e3a612..be02a76d9d8 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -493,6 +493,17 @@
# statements running at least this number
# of milliseconds
+#log_min_duration_sample = -1 # -1 is disabled, 0 logs a sample of statements
+ # and their durations, > 0 logs only a sample of
+ # statements running at least this number
+ # of milliseconds
+ # Sample fraction is determined by log_statement_sample_rate
+
+#log_statement_sample_rate = 1.0 # Fraction of logged statements exceeding
+ # log_min_duration_sample to be logged.
+ # 1.0 logs all such statements, 0.0 never logs.
+
+
#log_transaction_sample_rate = 0.0 # Fraction of transactions whose statements
# are logged regardless of their duration. 1.0 logs all
# statements from all transactions, 0.0 never logs.