Re: [PROPOSAL] extend the object names to the qualified names in pg_stat_statements

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Sergei Agalakov <sergei(dot)agalakov(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PROPOSAL] extend the object names to the qualified names in pg_stat_statements
Date: 2018-11-29 17:47:41
Message-ID: 20181129174741.jcnuw5xdgsguuuqv@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018-Nov-28, Tom Lane wrote:

> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> > On 2018-Nov-28, Tom Lane wrote:
> >> This would also entail rather significant overhead to find out schema
> >> names and interpolate them into the text.
>
> > True. I was thinking that the qualified-names version of the query
> > would be obtained via ruleutils or some similar mechanism to deparse
> > from the parsed query tree (not from the original query text), where
> > only pg_catalog is considered visible. This would be enabled using a
> > GUC that defaults to off.
>
> Color me skeptical --- ruleutils has never especially been designed
> to be fast, and I can't see that the overhead of this is going to be
> acceptable to anybody who needs pg_stat_statements in production.
> (Some admittedly rough experiments suggest that we might be
> talking about an order-of-magnitude slowdown for simple queries.)

Good point.

Maybe we can save the OID array of schemas that are in search_path when
the query is first entered into the statement pool, and produce the
query_qn column only at the time the entry is interpreted (that is, when
pg_stat_statements is query). ... oh, but that requires saving the plan
tree too, which doesn't sound very convenient.

Maybe just storing the search_path schemas (as Tomas already suggested)
is sufficient for Sergei's use case? Do away with query_qn as such, and
just have the user interpret the names according to the stored
search_path.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Dolgov 2018-11-29 17:48:12 Re: [HACKERS][PATCH] Applying PMDK to WAL operations for persistent memory
Previous Message Alvaro Herrera 2018-11-29 17:35:15 Re: New GUC to sample log queries