Re: [HACKERS] why not parallel seq scan for slow functions
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>,
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-03-24T03:11:09Z
Lists: pgsql-hackers
Attachments
- 0007-Use-NULL-relids-set.patch (application/octet-stream) patch 0007
- 0006-CP_IGNORE_TLIST.patch (application/octet-stream) patch 0006
- 0005-Remove-explicit-path-construction-logic-in-create_or.patch (application/octet-stream) patch 0005
- 0004-Postpone-generate_gather_paths-for-topmost-scan-join.patch (application/octet-stream) patch 0004
- 0003-Add-new-upper-rel-to-represent-projecting-toplevel-s.patch (application/octet-stream) patch 0003
- 0002-Adjust-use_physical_tlist-to-work-on-upper-rels.patch (application/octet-stream) patch 0002
- 0001-Teach-create_projection_plan-to-omit-projection-wher.patch (application/octet-stream) patch 0001
On Fri, Mar 23, 2018 at 12:12 AM, Amit Kapila <amit.kapila16@gmail.com> wrote: > Yeah, sometimes that kind of stuff change performance characteristics, > but I think what is going on here is that create_projection_plan is > causing the lower node to build physical tlist which takes some > additional time. I have tried below change on top of the patch series > and it brings back the performance for me. I tried another approach inspired by this, which is to altogether skip building the child scan tlist if it will just be replaced. See 0006. In testing here, that seems to be a bit better than your proposal, but I wonder what your results will be. > Before returning subplan, don't we need to copy the cost estimates > from best_path as is done in the same function after few lines. The new 0006 takes care of this, too. Really, the new 0006 should be merged into 0001, but I kept it separate for now. So, rebased: 0001 - More or less as before. 0002 - More or less as before. 0003 - Rewritten in the wake of partitionwise aggregate, as the tlist_rel must be partitioned in order for partitionwise aggregate to work. Quite pleasingly, this eliminates a bunch of Result nodes from the partitionwise join test results. Overall, I find this quite a bit cleaner than the present code (leaving performance aside for the moment). In the process of writing this I realized that the partitionwise aggregate code doesn't look like it handles SRFs properly, so if this doesn't get committed we'll have to fix that problem some other way. 0004 - A little different than before as a result of the extensive changes in 0003. 0005 - Also different, and revealing another defect in partitionwise aggregate, as noted in the commit message. 0006 - Introduce CP_IGNORE_TLIST; optimization of 0001. 0007 - Use NULL relids set for the toplevel tlist upper rel. This seems to be slightly faster than the other way. This is an optimization of 0003. It looks in my testing like this still underperforms master on your test case. Do you get the same result? Any other ideas? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
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