Re: Sample rate added to pg_stat_statements

From: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
To: Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>
Cc: Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>, "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>, Sami Imseih <samimseih(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Sample rate added to pg_stat_statements
Date: 2025-01-09 21:05:33
Message-ID: fdcdad79-7258-410d-b0c4-f488087dca7d@tantorlabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 09.01.2025 22:13, Alena Rybakina wrote:
> Hi! Thank you for the work with this subject.
>
> I looked at your patch and noticed that this part of the code is
> repeated several times:
>
> if (nesting_level == 0)
>     {
>         if (!IsParallelWorker())
>             current_query_sampled =
> pg_prng_double(&pg_global_prng_state) < pgss_sample_rate;
>         else
>             current_query_sampled = false;
>
>     }
>
> I think you should put this in a function like
> update_current_query_sampled. I've attached a diff file with the changes.
>

Agree, thanks.

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ilia Evdokimov 2025-01-09 21:16:17 Re: Sample rate added to pg_stat_statements
Previous Message Michail Nikolaev 2025-01-09 21:00:03 Re: Why doesn't GiST VACUUM require a super-exclusive lock, like nbtree VACUUM?