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 6482A576-4465-4E46-A42C-F1767E8DDE30@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 6 Jan 2025, at 15:50, Ilia Evdokimov <ilya.evdokimov@tantorlabs.com> wrote:
>
> Any suggestions for improvements?

The patch looks good to me, just a few nits.

0. Perhaps, we could have a test for edge values of 0 and 1. I do not insist, just an idea to think about.

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);

Thanks!


Best regards, Andrey Borodin.


pgsql-hackers by date:

Previous
From: "Andrey M. Borodin"
Date:
Subject: Re: Sort functions with specialized comparators
Next
From: Andrew Dunstan
Date:
Subject: Re: Windows pg_basebackup unable to create >2GB pg_wal.tar tarballs ("could not close file: Invalid argument" when creating pg_wal.tar of size ~ 2^31 bytes)