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

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, 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-28 21:52:51
Message-ID: 1b4e4c5e-7007-cd61-aae5-4a1c248e385c@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/28/18 10:46 PM, Alvaro Herrera wrote:
> On 2018-Nov-28, Tom Lane wrote:
>
>> Sergei Agalakov <sergei(dot)agalakov(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-11-28 21:59:18 Re: [PROPOSAL] extend the object names to the qualified names in pg_stat_statements
Previous Message Thomas Munro 2018-11-28 21:52:33 Re: Python versions (was Re: RHEL 8.0 build)