pgsql: Allow compute_query_id to be set to 'auto' and make it default

Started by Alvaro Herreraabout 5 years ago4 messagescomitters
Jump to latest
#1Alvaro Herrera
alvherre@2ndquadrant.com

Allow compute_query_id to be set to 'auto' and make it default

Allowing only on/off meant that all either all existing configuration
guides would become obsolete if we disabled it by default, or that we
would have to accept a performance loss in the default config if we
enabled it by default. By allowing 'auto' as a middle ground, the
performance cost is only paid by those who enable pg_stat_statements and
similar modules.

I only edited the release notes to comment-out a paragraph that is now
factually wrong; further edits are probably needed to describe the
related change in more detail.

Author: Julien Rouhaud <rjuju123@gmail.com>
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>
Discussion: /messages/by-id/20210513002623.eugftm4nk2lvvks3@nol

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/cafde58b337e007cb6a719f5ab4dd6459d932a39

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 6 ++++
contrib/pg_stat_statements/pg_stat_statements.conf | 1 -
doc/src/sgml/config.sgml | 9 +++--
doc/src/sgml/pgstatstatements.sgml | 14 +++-----
doc/src/sgml/release-14.sgml | 2 ++
src/backend/commands/explain.c | 2 +-
src/backend/parser/analyze.c | 4 +--
src/backend/postmaster/postmaster.c | 3 ++
src/backend/tcop/postgres.c | 2 +-
src/backend/utils/misc/guc.c | 38 ++++++++++++++++------
src/backend/utils/misc/postgresql.conf.sample | 2 +-
src/backend/utils/misc/queryjumble.c | 21 ++++++++++++
src/include/utils/guc.h | 1 -
src/include/utils/queryjumble.h | 33 +++++++++++++++++--
14 files changed, 108 insertions(+), 30 deletions(-)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#1)
Re: pgsql: Allow compute_query_id to be set to 'auto' and make it default

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:

Allow compute_query_id to be set to 'auto' and make it default

culicidae seems unhappy:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=culicidae&amp;dt=2021-05-15%2018%3A20%3A08

/mnt/resource/andres/bf/culicidae/HEAD/pgsql.build/../pgsql/src/backend/postmaster/postmaster.c: In function \342\200\230save_backend_variables\342\200\231:
/mnt/resource/andres/bf/culicidae/HEAD/pgsql.build/../pgsql/src/backend/postmaster/postmaster.c:6172:33: error: \342\200\230auto_query_id_enabled\342\200\231 undeclared (first use in this function)
6172 | param->auto_query_id_enabled = auto_query_id_enabled;
| ^~~~~~~~~~~~~~~~~~~~~
/mnt/resource/andres/bf/culicidae/HEAD/pgsql.build/../pgsql/src/backend/postmaster/postmaster.c:6172:33: note: each undeclared identifier is reported only once for each function it appears in
/mnt/resource/andres/bf/culicidae/HEAD/pgsql.build/../pgsql/src/backend/postmaster/postmaster.c: In function \342\200\230restore_backend_variables\342\200\231:
/mnt/resource/andres/bf/culicidae/HEAD/pgsql.build/../pgsql/src/backend/postmaster/postmaster.c:6406:2: error: \342\200\230auto_query_id_enabled\342\200\231 undeclared (first use in this function)
6406 | auto_query_id_enabled = param->auto_query_id_enabled;
| ^~~~~~~~~~~~~~~~~~~~~
make[3]: *** [../../../src/Makefile.global:920: postmaster.o] Error 1

Not sure why it's only that animal.

regards, tom lane

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tom Lane (#2)
Re: pgsql: Allow compute_query_id to be set to 'auto' and make it default

I wrote:

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:

Allow compute_query_id to be set to 'auto' and make it default

culicidae seems unhappy: ...
Not sure why it's only that animal.

Oh ... EXEC_BACKEND, likely, seeing that the Windows animals
are going red as well.

regards, tom lane

#4Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#3)
Re: pgsql: Allow compute_query_id to be set to 'auto' and make it default

On 2021-May-15, Tom Lane wrote:

I wrote:

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:

Allow compute_query_id to be set to 'auto' and make it default

culicidae seems unhappy: ...
Not sure why it's only that animal.

Oh ... EXEC_BACKEND, likely, seeing that the Windows animals
are going red as well.

Yeah, pushed a fix now.

--
�lvaro Herrera Valdivia, Chile