Re: [PROPOSAL] extend the object names to the qualified names inpg_stat_statements - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: [PROPOSAL] extend the object names to the qualified names inpg_stat_statements
Date
Msg-id 1b4e4c5e-7007-cd61-aae5-4a1c248e385c@2ndquadrant.com
Whole thread Raw
In response to Re: [PROPOSAL] extend the object names to the qualified names inpg_stat_statements  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: [PROPOSAL] extend the object names to the qualified names inpg_stat_statements  (Christoph Berg <myon@debian.org>)
List pgsql-hackers

On 11/28/18 10:46 PM, Alvaro Herrera wrote:
> On 2018-Nov-28, Tom Lane wrote:
> 
>> Sergei Agalakov <sergei.agalakov@gmail.com> writes:
>>> It would help to analyze performance issues if pg_stat_statements would 
>>> extend the object names to the qualified names.
>>
>> What pg_stat_statements puts out is the original query text.  As was
>> already pointed out to you, changing that text is likely to break
>> use-cases in which people are trying to match entries to actual
>> queries or log entries.
> 
> It's not immediately obvious, but he is proposing a _new_ column
> query_qn that has qualified names, leaving the current query column
> unchanged.
> 
>> 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.
> 

Wouldn't it be sufficient / better to just store the search_path used
when executing the query? That should be enough to resolve the object
names correctly, and the overhead would be much lower (both in terms
extra space and CPU overhead).

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Python versions (was Re: RHEL 8.0 build)
Next
From: Tom Lane
Date:
Subject: Re: [PROPOSAL] extend the object names to the qualified names in pg_stat_statements