Re: [HACKERS] why not parallel seq scan for slow functions
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Marina Polyakova <m.polyakova@postgrespro.ru>, pgsql-hackers <pgsql-hackers@postgresql.org>,
Jeff Janes <jeff.janes@gmail.com>, Thomas Munro <thomas.munro@enterprisedb.com>,
Amit Khandekar <amitdkhan.pg@gmail.com>, Dilip Kumar <dilipbalaut@gmail.com>,
Michael Paquier <michael.paquier@gmail.com>
Date: 2018-02-01T04:48:00Z
Lists: pgsql-hackers
On Tue, Jan 30, 2018 at 3:30 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Sun, Jan 28, 2018 at 10:13 PM, Amit Kapila <amit.kapila16@gmail.com> wrote:
>> If we want to get rid of Gather (Merge) checks in
>> apply_projection_to_path(), then we need some way to add a projection
>> path to the subpath of gather node even if that is capable of
>> projection as we do now. I think changing the order of applying
>> scan/join target won't address that unless we decide to do it for
>> every partial path. Another way could be that we handle that in
>> generate_gather_paths, but I think that won't be the idle place to add
>> projection.
>>
>> If we want, we can compute the parallel-safety of scan/join target
>> once in grouping_planner and then pass it in apply_projection_to_path
>> to address your main concern.
>
> I spent some time today hacking on this; see attached. It needs more
> work, but you can see what I have in mind.
>
I can see what you have in mind, but I think we still need to change
the parallel safety flag of the path if *_target is not parallel safe
either inside apply_projection_to_path or may be outside where it is
called. Basically, I am talking about below code:
@@ -2473,57 +2469,6 @@ apply_projection_to_path(PlannerInfo *root,
{
..
- else if (path->parallel_safe &&
- !is_parallel_safe(root, (Node *) target->exprs))
- {
- /*
- * We're inserting a parallel-restricted target list into a path
- * currently marked parallel-safe, so we have to mark it as no longer
- * safe.
- */
- path->parallel_safe = false;
- }
-
..
}
I can take care of dealing with this unless you think otherwise.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Commits
-
Rewrite the code that applies scan/join targets to paths.
- 11cf92f6e2e1 11.0 landed
-
Teach create_projection_plan to omit projection where possible.
- d7c19e62a8e0 11.0 landed
-
Make the upper part of the planner work by generating and comparing Paths.
- 3fc6e2d7f5b6 9.6.0 cited