Re: Passing query string to workers

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Rafia Sabih <rafia(dot)sabih(at)enterprisedb(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Passing query string to workers
Date: 2017-01-11 23:13:08
Message-ID: CA+TgmoabRinWRtHqpb6CGht_EWxnacNZW9trWnXN67CHdF+V8w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 11, 2017 at 7:37 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Rafia Sabih <rafia(dot)sabih(at)enterprisedb(dot)com> writes:
>> Approach:
>> A token for query string is created in the shared memory, this token is
>> populated with the query string using the global string --
>> debug_query_string. Now, for each of the worker when
>> ExecGetParallelQueryDesc is called, we retrieve the query text from shared
>> memory and pass it to CreateQueryDesc.
>
> This is simply wrong, because debug_query_string need have nothing to do
> with what the actual parallel query is. I'm all for sending over the
> correct query, but if you aren't bothering to accurately reproduce the
> master's query descriptor, I think you will increase confusion not
> reduce it.
>
> As far as reproducing the pg_stat_activity query goes, you could probably
> grab that string out of the master backend's pgstat entry and pass it over
> at parallel query start. But please don't confuse it with either
> debug_query_string or the string referenced by the QueryDesc; I do not
> think there's any guarantee that those are the same.

I think we should pass only the string referenced by the QueryDesc to
the worker, and on the worker side report that via debug_query_string
and pg_stat_activity and attach it to the QueryDesc itself. Is that
also your view?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-01-11 23:36:26 Re: Passing query string to workers
Previous Message David Rowley 2017-01-11 22:51:42 Re: CONNECTION LIMIT and Parallel Query don't play well together