Re: why not parallel seq scan for slow functions
Jeff Janes <jeff.janes@gmail.com>
From: Jeff Janes <jeff.janes@gmail.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-07-11T20:20:21Z
Lists: pgsql-hackers
Attachments
- subpath_projection_cost.patch (application/octet-stream) patch
On Mon, Jul 10, 2017 at 9:51 PM, Dilip Kumar <dilipbalaut@gmail.com> wrote: > > > In below function, we always multiply the target->cost.per_tuple with > path->rows, but in case of gather it should multiply this with > subpath->rows > > apply_projection_to_path() > .... > > path->startup_cost += target->cost.startup - oldcost.startup; > path->total_cost += target->cost.startup - oldcost.startup + > (target->cost.per_tuple - oldcost.per_tuple) * path->rows; > > > So because of this high projection cost the seqpath and parallel path > both have fuzzily same cost but seqpath is winning because it's > parallel safe. > I think you are correct. However, unless parallel_tuple_cost is set very low, apply_projection_to_path never gets called with the Gather path as an argument. It gets ruled out at some earlier stage, presumably because it assumes the projection step cannot make it win if it is already behind by enough. So the attached patch improves things, but doesn't go far enough. Cheers, Jeff
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