Log a sample of transactions
Adrien Nayrat <adrien.nayrat@anayrat.info>
From: Adrien Nayrat <adrien.nayrat@anayrat.info>
To: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Cc: Nikolay Samokhvalov <samokhvalov@gmail.com>
Date: 2018-12-12T21:32:06Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Tweak docs for log_statement_sample_rate
- d1f04b96b99d 12.0 landed
Attachments
- log_xact-1.patch (text/x-patch) patch
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