Log a sample of transactions

From: Adrien Nayrat <adrien(dot)nayrat(at)anayrat(dot)info>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Cc: Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>
Subject: Log a sample of transactions
Date: 2018-12-12 21:32:06
Message-ID: f5462aff-7bb4-f5b4-da3e-abb391956179@anayrat.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

Per idea of Nikolay Samokhvalov[1] I propose this patch to add the possibility
to log all statements from a fraction of transactions.

I have several questions:
* Do we want this feature?
* How can I add tests? I seems hard to handle tests when a there is duration
in the output.
* Should I handle the case when someone try to change the setting *inside* a
transaction:

# SET client_min_messages to LOG;
SET
# SET log_transaction_sample_rate to 1;
SET
# BEGIN;
LOG: duration: 0.364 ms statement: BEGIN;
BEGIN
# SELECT 1;
LOG: duration: 0.530 ms statement: SELECT 1;
-[ RECORD 1 ]
?column? | 1

# SET log_transaction_sample_rate to 0;
LOG: duration: 0.333 ms statement: SET log_transaction_sample_rate to 0;
SET
# SELECT 1;
LOG: duration: 0.586 ms statement: SELECT 1;
-[ RECORD 1 ]
?column? | 1

Thanks

[1]:
https://www.postgresql.org/message-id/CANNMO%2BLg65EFqHb%2BZYbMLKyE2y498HJzsdFrMnW1dQ6AFJ3Mpw%40mail.gmail.com

--
Adrien NAYRAT

Attachment Content-Type Size
log_xact-1.patch text/x-patch 6.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2018-12-12 21:48:22 Re: WIP: Avoid creation of the free space map for small tables
Previous Message Pablo Iranzo Gómez 2018-12-12 20:46:19 Re: Introducing SNI in TLS handshake for SSL connections