Re: Choosing parallel_degree

From: Julien Rouhaud <julien(dot)rouhaud(at)dalibo(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, James Sewell <james(dot)sewell(at)lisasoft(dot)com>
Subject: Re: Choosing parallel_degree
Date: 2016-03-17 23:26:07
Message-ID: 56EB3D0F.6030201@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16/03/2016 18:42, Robert Haas wrote:
> On Wed, Mar 16, 2016 at 1:23 PM, Julien Rouhaud
> <julien(dot)rouhaud(at)dalibo(dot)com> wrote:
>> On 16/03/2016 17:55, Robert Haas wrote:
>>> On Wed, Mar 16, 2016 at 12:47 PM, Julien Rouhaud
>>> <julien(dot)rouhaud(at)dalibo(dot)com> wrote:
>>>> Something like a "min_parallel_degree" then ?
>>>
>>> Why not just parallel_degree without any prefix? As in, when scanning
>>> this table in parallel, the reloption suggests using N workers.
>>>
>>
>> Agreed.
>>
>> PFA v2 that implements that.
>
> I think create_parallel_paths shouldn't actually run the loop if the
> reloption is specified; it should just adopt the specified value (or
> max_parallel_degree, whichever is less). Right now, you have it doing
> the work to compute the default value but then overriding it.
>

After a second look at this part:

/*
* Limit the degree of parallelism logarithmically based on the size of the
* relation. This probably needs to be a good deal more sophisticated,
but we
* need something here for now.
*/
while (rel->pages > parallel_threshold * 3 &&
parallel_degree < max_parallel_degree)
{
parallel_degree++;
parallel_threshold *= 3;
if (parallel_threshold >= PG_INT32_MAX / 3)
break;
}

Shouldn't we also check "parallel_degree < max_worker_process" ?

There's no need to compute any further than that. I think the best fix
would be to add a CheckHook or AssignHook on max_parallel_degree GUC to
make sure it's not more than max_worker_process.

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2016-03-17 23:37:42 Re: Make primnodes.h gender neutral
Previous Message Mark Dilger 2016-03-17 23:17:14 Re: Make primnodes.h gender neutral