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>, "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(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>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Sample rate added to pg_stat_statements
Date: 2025-01-08 21:25:15
Message-ID: 9af7cb4e-d191-421f-85a2-22d8c406b47a@tantorlabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 08.01.2025 22:39, Ilia Evdokimov wrote:
>
> After the changes in v9-patch, won’t all the necessary queries now be
> normalized? Since there are no longer any restrictions in the parser
> hook, queries will be normalized as usual, and pgss_planner,
> pgss_ExecutorStart, and ExecutorEnd will simply fetch them from
> 'pgss_query_texts.stat' file.
>
> For now, this seems like the simplest approach instead of making
> JumbleState available to other hooks. Moreover, if we do proceed with
> that, we might be able to remove the 'pgss_query_texts.stat' file
> altogether and more other improvements. In my view, if no other
> options arise, we should address making JumbleState available to other
> hooks in a separate thread. If you have any suggestions, I'm always
> open to feedback.
>
> I attached v9 patch with changes and test above.

Unfortunately, these changes do not achieve the intended sampling goal.
I looked into this more deeply: while the sampled-out queries do not
appear in pg_stat_statements, an entry is still allocated in the hash
table after normalization, which, in my view, should not happen when
sampling is in effect. Therefore, patch v9 is unlikely to meet our needs.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vinícius Abrahão 2025-01-08 21:32:58 Re: New GUC autovacuum_max_threshold ?
Previous Message Tom Lane 2025-01-08 21:24:34 Re: Parameter NOT NULL to CREATE DOMAIN not the same as CHECK (VALUE IS NOT NULL)