Christophe Pettus introduces three new Global Configuration parameters designed to log only a random sample of queries rather than every statement. These settings—log_min_duration_sample, log_statement_sample_rate, and log_transaction_sample_rate—allow DBAs to capture representative query statistics without the overhead of recording every single execution. This approach helps identify performance patterns in high-throughput environments where full logging would be prohibitively expensive.
- Use log_statement_sample_rate to log only a fraction of statements, reducing I/O and storage overhead.
- Apply log_min_duration_sample to filter sampled queries by execution time, focusing on slow operations.
- Enable log_transaction_sample_rate to sample entire transactions, preserving context for multi-statement workloads.
- Aggregate statistics from samples can reveal performance trends without the cost of full query logging.