Re: Gather Merge

From: Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>
To: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
Cc: Andreas Joseph Krogh <andreas(at)visena(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Gather Merge
Date: 2017-03-10 10:39:08
Message-ID: CAGz5QCLvYC6rOj-aG-gZMhuFuUk1u3YiNfuTP40O75vaFCCFvw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 10, 2017 at 3:04 PM, Rushabh Lathia
<rushabh(dot)lathia(at)gmail(dot)com> wrote:
>
>
> On Fri, Mar 10, 2017 at 2:42 PM, Andreas Joseph Krogh <andreas(at)visena(dot)com>
> wrote:
>>
>> På fredag 10. mars 2017 kl. 10:09:22, skrev Rushabh Lathia
>> <rushabh(dot)lathia(at)gmail(dot)com>:
>>
>>
>>
>> On Fri, Mar 10, 2017 at 2:33 PM, Andreas Joseph Krogh <andreas(at)visena(dot)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 & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
dump.sql application/sql 377.1 KB
gm_error.sql application/sql 259 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rushabh Lathia 2017-03-10 10:42:42 Re: Gather Merge
Previous Message Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?= 2017-03-10 10:38:49 Re: [PATCH] Teach Catalog.pm how many attributes there should be per DATA() line