Re: Sample rate added to pg_stat_statements

From: Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>
To: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
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 19:13:26
Message-ID: b40b76c3-fc54-4f11-a50f-e63cd6434560@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

--
Regards,
Alena Rybakina
Postgres Professional

Attachment Content-Type Size
Allow_setting_sample_ratio_for_pg_stat_statements.diff text/x-patch 7.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2025-01-09 19:18:21 Re: [PoC] Federated Authn/z with OAUTHBEARER
Previous Message Alvaro Herrera 2025-01-09 19:10:54 Re: Psql meta-command conninfo+