Re: Sample rate added to pg_stat_statements - Mailing list pgsql-hackers

From Andrey M. Borodin
Subject Re: Sample rate added to pg_stat_statements
Date
Msg-id 9D8A5BC8-A3A5-4DA9-9382-F30D343247D1@yandex-team.ru
Whole thread Raw
In response to Re: Sample rate added to pg_stat_statements  ("Andrey M. Borodin" <x4mmm@yandex-team.ru>)
Responses Re: Sample rate added to pg_stat_statements
List pgsql-hackers

> 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.


pgsql-hackers by date:

Previous
From: Atsushi Torikoshi
Date:
Subject: Re: RFC: Allow EXPLAIN to Output Page Fault Information
Next
From: Tom Lane
Date:
Subject: Re: Temporary Views Cleanup Issue