Re: [HACKERS] why not parallel seq scan for slow functions

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Marina Polyakova <m(dot)polyakova(at)postgrespro(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Subject: Re: [HACKERS] why not parallel seq scan for slow functions
Date: 2018-03-24 03:11:09
Message-ID: CA+TgmoZbscGTw8M7i4ZBr2LksH13jiVqbXBG=KTWRV=RZmspYQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 23, 2018 at 12:12 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)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

Attachment Content-Type Size
0007-Use-NULL-relids-set.patch application/octet-stream 1.1 KB
0006-CP_IGNORE_TLIST.patch application/octet-stream 6.5 KB
0005-Remove-explicit-path-construction-logic-in-create_or.patch application/octet-stream 7.4 KB
0004-Postpone-generate_gather_paths-for-topmost-scan-join.patch application/octet-stream 7.5 KB
0003-Add-new-upper-rel-to-represent-projecting-toplevel-s.patch application/octet-stream 60.8 KB
0002-Adjust-use_physical_tlist-to-work-on-upper-rels.patch application/octet-stream 1.6 KB
0001-Teach-create_projection_plan-to-omit-projection-wher.patch application/octet-stream 3.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2018-03-24 03:42:06 Re: [HACKERS] path toward faster partition pruning
Previous Message Vimal Rathod 2018-03-24 03:09:29 Fwd: Re: GSOC 2018 Ideas