Doc update for pg_stat_statements normalization

From: "Imseih (AWS), Sami" <simseih(at)amazon(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Doc update for pg_stat_statements normalization
Date: 2023-02-24 20:54:00
Message-ID: 9CFF3512-355B-4676-8CCC-6CF622F4DC1A@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Replacing constants in pg_stat_statements is on a best effort basis.
It is not unlikely that on a busy workload with heavy entry deallocation,
the user may observe the query with the constants in pg_stat_statements.

From what I can see, this is because the only time an entry is normalized is
during post_parse_analyze, and the entry may be deallocated by the time query
execution ends. At that point, the original form ( with constants ) of the query
is used.

It is not clear how prevalent this is in real-world workloads, but it's easily reproducible
on a workload with high entry deallocation. Attached are the repro steps on the latest
branch.

I think the only thing to do here is to call this out in docs with a suggestion to increase
pg_stat_statements.max to reduce the likelihood. I also attached the suggested
doc enhancement as well.

Any thoughts?

Regards,

--
Sami Imseih
Amazon Web Services

Attachment Content-Type Size
report.txt text/plain 1.9 KB
0001-doc-update-regarding-pg_stat_statements-normalizatio.patch application/octet-stream 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2023-02-24 21:06:31 Re: Disable vacuuming to provide data history
Previous Message Heikki Linnakangas 2023-02-24 20:31:57 Re: Marking options deprecated in help output