Re: Enabling parallelism for queries coming from SQL or other PL functions
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Rafia Sabih <rafia.sabih@enterprisedb.com>, PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2017-03-21T19:25:59Z
Lists: pgsql-hackers
On Tue, Mar 21, 2017 at 6:36 AM, Dilip Kumar <dilipbalaut@gmail.com> wrote: > On Tue, Mar 21, 2017 at 3:36 PM, Rafia Sabih > <rafia.sabih@enterprisedb.com> wrote: >> On Wed, Mar 15, 2017 at 8:55 PM, Robert Haas <robertmhaas@gmail.com> wrote: >>> Note this: >>> >>> if (completed || !fcache->returnsSet) >>> postquel_end(es); >>> >>> When the SQL function doesn't return a set, then we can allow >>> parallelism even when lazyEval is set, because we'll only call >>> ExecutorStart() once. But my impression is that something like this: > > How about taking the decision of execute_once based on > fcache->returnsSet instead of based on lazyEval? > > change > + ExecutorRun(es->qd, ForwardScanDirection, count, !es->lazyEval); > to > + ExecutorRun(es->qd, ForwardScanDirection, count, !fcache->returnsSet); > > IMHO, Robert have the same thing in mind? Yeah, something like that. >>SELECT * FROM blah() LIMIT 3 >> >>...will trigger three separate calls to ExecutorRun(), which is a >>problem if the plan is a parallel plan. > > And you also need to test this case what Robert have mentioned up thread. +1 -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Improve access to parallel query from procedural languages.
- 61c2e1a95f94 10.0 landed
-
plpgsql: Don't generate parallel plans for RETURN QUERY.
- 5674a258fd7e 9.6.3 landed
- f120b614e070 10.0 landed
-
Allow for parallel execution whenever ExecutorRun() is done only once.
- 691b8d59281b 10.0 landed