Re: Sample rate added to pg_stat_statements - Mailing list pgsql-hackers

From Ilia Evdokimov
Subject Re: Sample rate added to pg_stat_statements
Date
Msg-id 51e93798-cd3b-4855-aaa4-78985025cd76@tantorlabs.com
Whole thread Raw
In response to Re: Sample rate added to pg_stat_statements  (Sami Imseih <samimseih@gmail.com>)
List 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

pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: Options to control remote transactions’ access/deferrable modes in postgres_fdw
Next
From: Dmitry Dolgov
Date:
Subject: Re: pg_stat_statements and "IN" conditions