> On 7 Jan 2025, at 16:05, Ilia Evdokimov <ilya.evdokimov@tantorlabs.com> wrote:
>
>> 1. This code seems a little different from your patch. It is trying to avoid engaging PRNG. I'm not sure it's a good
idea,but still. Also, it uses "<=", not "<".
>>
>> xact_is_sampled = log_xact_sample_rate != 0 &&
>> (log_xact_sample_rate == 1 ||
>> pg_prng_double(&pg_global_prng_state) <= log_xact_sample_rate);
>>
> Are we sure we're discussing the same patch? Because these remarks refer to the 5 version of the patch, which I
abandoneddue to your remarks.
Yes. v6 has this code
+ if (nesting_level == 0)
+ current_query_sampled = (pg_prng_double(&pg_global_prng_state) < pgss_sample_rate);
while upstream has code that I cited. And logic is slightly different.
Best regards, Andrey Borodin.