Re: Sample rate added to pg_stat_statements

From: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
To: Sami Imseih <samimseih(at)gmail(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 Borodin <x4mmm(at)yandex-team(dot)ru>, Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Sample rate added to pg_stat_statements
Date: 2025-03-03 12:55:42
Message-ID: 51e93798-cd3b-4855-aaa4-78985025cd76@tantorlabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 20.02.2025 04:04, Sami Imseih wrote:
> In my opinion, sample rate is a better fit for pg_stat_statements,
> since the queries that
> you care about the most are usually the most frequently executed. Sampling them
> will still provide enough good data without the risk of not capturing
> statistics about
> them at all.
>
> Longer running queries will also likely be the least frequent, so they
> are already not likely
> contributing to the spinlock contention. Also, the least frequent
> queries will likely be aged
> out faster, so pg_stat_statements was never really a good candidate to
> track those anyways;
> slow query logging with log_min_duration_statement is a better way to
> ensure you capture
> the data.
>
> Maybe others may have a different opinion?
>
> --
>
> Sami

Hi everyone,

Since most people have expressed support for sampling based on frequency
of query, I will revert the rebased patch for version v15. Also, given
that everyone is likely busy with the higher-priority task of IN
normalization in pg_stat_statements, I will leave the rebased v19-patch
here and move it back to Ready for Committer, as the patch has already
been it.

Any suggestions are welcome.

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

Attachment Content-Type Size
v19-0001-Allow-setting-sample-rate-for-pg_stat_statements.patch text/x-patch 13.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Dolgov 2025-03-03 13:13:54 Re: pg_stat_statements and "IN" conditions
Previous Message Ashutosh Bapat 2025-03-03 12:51:15 Re: Options to control remote transactions’ access/deferrable modes in postgres_fdw