Re: Sample rate added to pg_stat_statements

Поиск
Список
Период
Сортировка
От Andrey M. Borodin
Тема Re: Sample rate added to pg_stat_statements
Дата
Msg-id 9D8A5BC8-A3A5-4DA9-9382-F30D343247D1@yandex-team.ru
обсуждение исходный текст
Ответ на Re: Sample rate added to pg_stat_statements  ("Andrey M. Borodin" <x4mmm@yandex-team.ru>)
Ответы Re: Sample rate added to pg_stat_statements
Список 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 по дате отправления: