Re: Log a sample of transactions

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Adrien NAYRAT <adrien(dot)nayrat(at)anayrat(dot)info>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>
Subject: Re: Log a sample of transactions
Date: 2019-01-16 09:09:56
Message-ID: CAD21AoD4t+hTV6XfK5Yz=EocB8oMyJSYFfjAryCDYtqfib2GrA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 16, 2019 at 2:03 AM Adrien NAYRAT
<adrien(dot)nayrat(at)anayrat(dot)info> wrote:
>
> On 1/15/19 11:42 AM, Masahiko Sawada wrote:
> >> When you troubleshoot applicative issues with multi-statements transaction, you may have to log all queries to find all statements of one transaction. With high throughput, it could be hard to log all queries without causing troubles.
> > Hm, can we use log_min_duration_statement to find slow queries of a
> > transaction instead? Could you please elaborate on the use-case?
>
> Hello,
>
> The goal is not to find slow queries in a transaction, but troubleshoot
> applicative issue when you have short queries.
>
> Sometimes you want to understand what happens in a transaction, either
> you perfectly know your application, either you have to log all queries
> and find ones with the same transaction ID (%x). It could be problematic
> if you have a huge traffic with fast queries.
>

Thank you for the explain! I understood the use case of this patch.
This feature would be helpful for troubleshooting.

Since we set xact_is_sampled only when transaction starts and see it
during transaction we cannot disable logging during transaction and
vice versa. I can imagine the use case where user wants to disable
logging during transaction. So it might be better to also check if
log_xact_sample_rate > 0 in check_log_duration().

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-01-16 09:15:11 Re: Python versions (was Re: RHEL 8.0 build)
Previous Message Surafel Temesgen 2019-01-16 08:45:46 Re: FETCH FIRST clause WITH TIES option