Re: Adding percentile metrics to pg_stat_statements module

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Igor Calabria <igor(dot)calabria(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding percentile metrics to pg_stat_statements module
Date: 2019-10-31 16:36:27
Message-ID: CAFj8pRBNMeBB5ja9aiqMcqJUbxpw3_3DTF7_44mqYti5FSNsZg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

čt 31. 10. 2019 v 16:51 odesílatel Igor Calabria <igor(dot)calabria(at)gmail(dot)com>
napsal:

> Hi everyone,
>
> I was taking a look at pg_stat_statements module and noticed that it does
> not collect any percentile metrics. I believe that It would be really handy
> to have those available and I'd love to contribute with this feature.
>
> The basic idea is to accumulate the the query execution times using an
> approximation structure like q-digest or t-digest and add those results to
> the pg_stat_statements table as fixed columns. Something like this
>
> p90_time:
> p95_time:
> p99_time:
> p70_time:
> ...
>
> Another solution is to persist de digest structure in a binary column and
> use a function to extract the desired quantile ilke this SELECT
> approx_quantile(digest_times, 0.99) FROM pg_stat_statements
>
> What do you guys think?
>

+ the idea

But I am not sure about performance and memory overhead

Pavel

> Cheers,
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2019-10-31 16:48:22 idea - proposal - defining own psql commands
Previous Message Andres Freund 2019-10-31 16:36:15 Re: Allow cluster_name in log_line_prefix