On Fri, Mar 10, 2017 at 3:04 PM, Rushabh Lathia <rushabh.lathia@gmail.com> wrote: > > > On Fri, Mar 10, 2017 at 2:42 PM, Andreas Joseph Krogh <andreas@visena.com> > wrote: >> >> På fredag 10. mars 2017 kl. 10:09:22, skrev Rushabh Lathia >> <rushabh.lathia@gmail.com>: >> >> >> >> On Fri, Mar 10, 2017 at 2:33 PM, Andreas Joseph Krogh <andreas@visena.com> >> wrote: >>> >>> [...] >>> The execution-plan seems (unsurprisingly) to depend on data-distribution, >>> so is there a way I can force a GatherMerge? >> >> >> Not directly. GatherMerge cost is mainly depend on parallel_setup_cost, >> parallel_tuple_cost and cpu_operator_cost. May be you can force this >> by setting this cost low enough. Or another way to force is by disable the >> other plans. >> >> What plan you are getting now? You not seeing the below error ? >> >> ERROR: GatherMerge child's targetlist doesn't match GatherMerge >> >> >> I'm seeing the same error, it's just that for reproducing it I'd rather >> not copy my whole dataset. > > > Can you share me a schema information, I will try to reproduce at my side? I'm able to reproduce the error. I've attached the dump file and a script to reproduce it.
The following query executes successfully. postgres=# explain select t1.* from t1 JOIN t2 ON t1.k=t2.k where t1.i=1 order by t1.j desc; QUERY PLAN ------------------------------------------------------------------------------------------------------- Gather Merge (cost=0.58..243.02 rows=943 width=12) Workers Planned: 1 -> Nested Loop (cost=0.57..235.94 rows=555 width=12) -> Parallel Index Scan Backward using idx_t1_i_j on t1 (cost=0.29..14.33 rows=603 width=12) Index Cond: (i = 1) -> Index Only Scan using idx_t2_k on t2 (cost=0.29..0.34 rows=3 width=4) Index Cond: (k = t1.k) (7 rows)
Whereas, If columns from t2 is projected, it throws the same error. postgres=# explain select t2.* from t1 JOIN t2 ON t1.k=t2.k where t1.i=1 order by t1.j desc; ERROR: GatherMerge child's targetlist doesn't match GatherMerge
Thanks Kuntal.
I am able to reproduce the issue with the shared script. I will look into