Dear Adrien,
>> * xact_is_sampled is left at the end of a transaction.
>> Should the parameter be set to false at the lowest layer of the transaction system?
>> I understand it is unnecessary for the functionality, but it have more symmetry.
>
> Yes, it is not necessary. I wonder what is more important : keep some
>kind of symmetry or avoid unnecessary code (which can be source of mistake)?
>>
>> * check_log_duration should be used only when postgres check the duration.
>> But I'm not sure a new function such as check_is_sampled is needed because A processing in new function will be as
almostsame as check_log_duration.
> I agree, I asked myself the same question and I preferred to keep code
simple.
I think your point is also correct.
You should inquire superior reviewers or committers because I cannot judge which one is better.
BTW, I give you a suggestion about a test.
This parameter enables users to log statements randomly, hence adding some tests is very difficult.
Perhaps Only three cases are available:
* When log_transaction_sample_rate is set to 1, all statements are logged.
* When the parameter is set to 0, they are never logged.
* When the parameter change to 0 inside the transaction, logging is immediately stopped.
Best Regards,
Hayato Kuroda
Fujitsu LIMITED