diff options
| author | Tomas Vondra <tomas.vondra@postgresql.org> | 2019-11-04 01:57:45 +0100 |
|---|---|---|
| committer | Tomas Vondra <tomas.vondra@postgresql.org> | 2019-11-06 19:11:07 +0100 |
| commit | 6e3e6cc0e884a6091e1094dff29db430af08fb93 (patch) | |
| tree | b44e1702678389fc68ec9a2da2ff5bb21c4db9a5 /src/include/utils | |
| parent | 11d9ac28e5e0077d8f23761c2962a30423f44cee (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/include/utils')
| -rw-r--r-- | src/include/utils/guc.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index 6791e0cbc20..9aa3d025965 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -251,8 +251,10 @@ extern bool session_auth_is_superuser; extern int log_min_error_statement; extern PGDLLIMPORT int log_min_messages; extern PGDLLIMPORT int client_min_messages; +extern int log_min_duration_sample; extern int log_min_duration_statement; extern int log_temp_files; +extern double log_statement_sample_rate; extern double log_xact_sample_rate; extern int temp_file_limit; |
