diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-04-03 18:43:59 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-04-03 18:43:59 -0300 |
commit | 799e220346f1387e823a4dbdc3b1c8c3cdc5c3e0 (patch) | |
tree | 3530d9162d2069475148fdb0db5218b1e1c02b4b /src/backend/utils/misc | |
parent | d8c0bd9fefa9c70a3f5613fba672fa92f08ea940 (diff) | |
download | postgresql-799e220346f1387e823a4dbdc3b1c8c3cdc5c3e0.tar.gz postgresql-799e220346f1387e823a4dbdc3b1c8c3cdc5c3e0.zip |
Log all statements from a sample of transactions
This is useful to obtain a view of the different transaction types in an
application, regardless of the durations of the statements each runs.
Author: Adrien Nayrat
Reviewed-by: Masahiko Sawada, Hayato Kuroda, Andres Freund
Diffstat (limited to 'src/backend/utils/misc')
-rw-r--r-- | src/backend/utils/misc/guc.c | 13 | ||||
-rw-r--r-- | src/backend/utils/misc/postgresql.conf.sample | 4 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index cd5a65be75b..83a9fc2b4c6 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -510,6 +510,7 @@ int client_min_messages = NOTICE; int log_min_duration_statement = -1; int log_temp_files = -1; double log_statement_sample_rate = 1.0; +double log_xact_sample_rate = 0; int trace_recovery_messages = LOG; int temp_file_limit = -1; @@ -3386,6 +3387,18 @@ static struct config_real ConfigureNamesReal[] = NULL, NULL, NULL }, + { + {"log_transaction_sample_rate", PGC_SUSET, LOGGING_WHEN, + gettext_noop("Set the fraction of transactions to log for new transactions."), + gettext_noop("Logs all statements from a fraction of transactions. " + "Use a value between 0.0 (never log) and 1.0 (log all " + "statements for all transactions).") + }, + &log_xact_sample_rate, + 0.0, 0.0, 1.0, + NULL, NULL, NULL + }, + /* End-of-list marker */ { {NULL, 0, 0, NULL, NULL}, NULL, 0.0, 0.0, 0.0, NULL, NULL, NULL diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 9b15361403e..f31d419f795 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -495,6 +495,10 @@ # log_min_duration_statement. 1.0 logs all statements, # 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. + # - What to Log - #debug_print_parse = off |