From: Dam <zhq651@126.com>
To: Julien Rouhaud <rjuju123@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Cc: tgl@sss.pgh.pa.us
Subject: Re:Re: BUG #16179: is it reasonable to callback pgss_post_parse_analyze or pg_hint_plan_post_parse_analyze ???
Date: Thu, 26 Dec 2019 10:59:19 +0800 (CST)
Message-ID: <7f868eab.20ee.16f4024ed93.Coremail.zhq651@126.com> (raw)
In-Reply-To: <CAOBaU_aNCoKx=y6gRB9Znd3RfNxjpAQLx=O+4j=sYfaA7ydJcA@mail.gmail.com>
References: <16179-f7f1d45afb4452bb@postgresql.org>
<CAOBaU_aNCoKx=y6gRB9Znd3RfNxjpAQLx=O+4j=sYfaA7ydJcA@mail.gmail.com>
I am afraid I can not agree with you.
1.For users, create extension action mean enable the extension,not configure library.And not all extension need configure library.
2.The solution that you mentioned ,will fix in pg13, is only for pg_stat_statment, not all.
--
发自我的网易邮箱手机智能版
<br/><br/><br/>
----- Original Message -----
From: "Julien Rouhaud" <rjuju123@gmail.com>
To: zhq651@126.com, "PostgreSQL mailing lists" <pgsql-bugs@lists.postgresql.org>
Sent: Wed, 25 Dec 2019 09:48:28 +0100
Subject: Re: BUG #16179: is it reasonable to callback pgss_post_parse_analyze or pg_hint_plan_post_parse_analyze ???
Hi,
On Wed, Dec 25, 2019 at 9:32 AM PG Bug reporting form
<noreply@postgresql.org> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference: 16179
> Logged by: DamionZ Zhao
> Email address: zhq651@126.com
> PostgreSQL version: 11.5
> Operating system: linux
> Description:
>
> When I only configure GUC as shared_preload_libraries = 'pg_hint_plan,
> pg_stat_statment'
> and have not run sql: 'create extension pg_hint_plan; create extension
> pg_stat_statment',
> I expected that parse_analyze will not run into functions
> :pgss_post_parse_analyze or pg_hint_plan_post_parse_analyze
>
> In fact , it does not . I print runtime call stack.
> -----------------------------------------------------
> statment 1: select
> #0 pgss_post_parse_analyze (pstate=0x2a45818, query=0x2a45928) at
> pg_stat_statements.c:812
> #1 0x00007fbe60506734 in pg_hint_plan_post_parse_analyze (pstate=0x2a45818,
> query=0x2a45928) at pg_hint_plan.c:2767
> #2 0x000000000058fbe5 in parse_analyze (parseTree=0x2a45798,
> sourceText=0x2a44a90 "select * from abcd;", paramTypes=0x0, numParams=0,
> queryEnv=0x0) at analyze.c:124
> [...]
>
> It will degrade performance and may cause the wrong result if it contains
> modify operation.
This is expected. The hooks are called as soon as the libraries are
loaded, so configuring shared_preload_libraries (and restarting
postgres) will activate the extensions. What you should do instead is
disable pg_stat_statements (or other extensions if they have such
possibility) if you want to be able to use it only when required,
without the need to restart postgres. The CREATE EXTENSION part is
only necessary to access the counters stored in shared memory.
Regarding the performance overhead, it's true that the queryid
generation will still happen even if you disable pg_stat_statements.
However, note that this will be fixed with pg13, see
https://www.postgresql.org/message-id/BN8PR21MB1217B003C4F79DE230AA36B9B1580%40BN8PR21MB1217.namprd2...
for more details.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: zhq651@126.com, rjuju123@gmail.com, tgl@sss.pgh.pa.us
Subject: Re: BUG #16179: is it reasonable to callback pgss_post_parse_analyze or pg_hint_plan_post_parse_analyze ???
In-Reply-To: <7f868eab.20ee.16f4024ed93.Coremail.zhq651@126.com>
References: <16179-f7f1d45afb4452bb@postgresql.org> <CAOBaU_aNCoKx=y6gRB9Znd3RfNxjpAQLx=O+4j=sYfaA7ydJcA@mail.gmail.com> <7f868eab.20ee.16f4024ed93.Coremail.zhq651@126.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox