Re: Parallel Seq Scan

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com>, Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, Jeff Davis <pgsql(at)j-davis(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Thom Brown <thom(at)linux(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parallel Seq Scan
Date: 2015-09-17 01:28:04
Message-ID: CA+Tgmobix55rfTBh0TYO1WQGqVOpOTOTGR27D5vhM9h=akpvLw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 3, 2015 at 6:21 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> [ new patches ]

+ pscan = shm_toc_lookup(node->ss.ps.toc, PARALLEL_KEY_SCAN);

This is total nonsense. You can't hard-code the key that's used for
the scan, because we need to be able to support more than one parallel
operator beneath the same funnel. For example:

Append
-> Partial Seq Scan
-> Partial Seq Scan

Each partial sequential scan needs to have a *separate* key, which
will need to be stored in either the Plan or the PlanState or both
(not sure exactly). Each partial seq scan needs to get assigned a
unique key there in the master, probably starting from 0 or 100 or
something and counting up, and then this code needs to extract that
value and use it to look up the correct data for that scan.

+ case T_ResultState:
+ {
+ PlanState *planstate =
((ResultState*)node)->ps.lefttree;
+
+ return
planstate_tree_walker((Node*)planstate, pcxt,
+
ExecParallelInitializeDSM, pscan_size);
+ }

This looks like another instance of using the walker incorrectly.
Nodes where you just want to let the walk continue shouldn't need to
be enumerated; dispatching like this should be the default case.

+ case T_Result:
+ fix_opfuncids((Node*) (((Result
*)node)->resconstantqual));
+ break;

Seems similarly wrong.

+ * cost_patialseqscan

Typo. The actual function name has the same typo.

+ num_parallel_workers = parallel_seqscan_degree;
+ if (parallel_seqscan_degree <= estimated_parallel_workers)
+ num_parallel_workers = parallel_seqscan_degree;
+ else
+ num_parallel_workers = estimated_parallel_workers;

Use Min?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2015-09-17 02:03:32 Re: Parallel Seq Scan
Previous Message Robert Haas 2015-09-17 01:18:17 Re: Parallel Seq Scan