|From:||Lukas Fittl <lukas(at)fittl(dot)com>|
|Subject:||[PATCH] Use $ parameters as replacement characters for pg_stat_statements|
|Views:||Raw Message | Whole Thread | Download mbox|
Currently pg_stat_statements replaces constant values with ? characters.
I've seen this be a problem on multiple occasions, in particular since it
conflicts with the use of ? as an operator.
I'd like to propose changing the replacement character from ? to instead be
a parameter (like $1).
My main motiviation is to aid external tools that parse pg_stat_statements
output (like ), and currently have to resort to complex parser patches
to distinguish operators from replacement characters.
First of all, attached 0001_pgss_additional_regression_tests.v1.patch which
increases regression test coverage for a few scenarios relevant to this
Then, there is two variants I've prepared, only one of the two to be
A) 0002_pgss_mask_with_incrementing_params.v1.patch: Replace constants with
$1, $2, $3 (etc) in the normalized query, whilst respecting any existing
params in the counting
B) 0003_pgss_mask_with_zero_param.v1.patch: Replace constants with $0 in
the normalized query
Ideally I'd see A turn into something we can commit, but it involves a bit
more computation to get the parameter numbers right. The benefit is that we
could use PREPARE/EXECUTE with pg_stat_statements output.
B is intentionally simple, and would address the primary issue at hand
(distinguishing from the ? operator).
I'm also adding this patch to the commitfest starting tomorrow.
|Next Message||Amit Langote||2017-03-01 01:36:24||Re: Declarative partitioning optimization for large amount of partitions|
|Previous Message||Rahila Syed||2017-03-01 00:59:28||Adding support for Default partition in partitioning|