[Postgres-xl-developers] bug about parallel execution

senhu(胡森) senhu at tencent.com
Tue Jun 20 23:42:31 PDT 2017


Hello, all:
   I ran TPCH queries on PG-XL 9.6 a few days ago, and I have found there is something wrong with parallel execution.
Here is the SQL:
select
        l_orderkey,
        sum(l_extendedprice * (1 - l_discount)) as revenue,
        o_orderdate,
        o_shippriority
from
        customer,
        orders,
        lineitem
where
        c_mktsegment = 'BUILDING'
        and c_custkey = o_custkey
        and l_orderkey = o_orderkey
        and o_orderdate < date '1995-03-20'
        and l_shipdate > date '1995-03-20'
group by
        l_orderkey,
        o_orderdate,
        o_shippriority
order by
        revenue desc,
        o_orderdate
LIMIT 10;

And the explanation:
                                                                 QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=3333664.38..3333664.40 rows=10 width=48)
   ->  Sort  (cost=3333664.38..3340613.85 rows=2779790 width=48)
         Sort Key: (sum((lineitem.l_extendedprice * ('1'::numeric - lineitem.l_discount)))) DESC, orders.o_orderdate
         ->  GroupAggregate  (cost=3190200.42..3273594.12 rows=2779790 width=48)
               Group Key: lineitem.l_orderkey, orders.o_orderdate, orders.o_shippriority
               ->  Sort  (cost=3190200.42..3197149.89 rows=2779790 width=28)
                     Sort Key: lineitem.l_orderkey, orders.o_orderdate, orders.o_shippriority
                     ->  Gather  (cost=659331.10..2759650.93 rows=2779790 width=28)
                           Workers Planned: 7
                           ->  Hash Join  (cost=658331.10..2480671.93 rows=2779790 width=28)
                                 Hash Cond: (orders.o_custkey = customer.c_custkey)
                                 ->  Remote Subquery Scan on all (datanode_1,datanode_2)  (cost=597875.97..2728346.91 rows=15588027 width=36)
                                       ->  Hash Join  (cost=597775.97..2089137.80 rows=15588027 width=36)
                                             Hash Cond: (lineitem.l_orderkey = orders.o_orderkey)
                                             ->  Parallel Seq Scan on lineitem  (cost=0.00..1321476.04 rows=4556727 width=20)
                                                   Filter: (l_shipdate > '1995-03-20'::date)
                                             ->  Hash  (cost=463188.50..463188.50 rows=7330678 width=20)
                                                   ->  Seq Scan on orders  (cost=0.00..463188.50 rows=7330678 width=20)
                                                         Filter: (o_orderdate < '1995-03-20'::date)
                                 ->  Hash  (cost=58452.05..58452.05 rows=297450 width=4)
                                       ->  Remote Subquery Scan on all (datanode_1,datanode_2)  (cost=100.00..58452.05 rows=297450 width=4)
                                             ->  Seq Scan on customer  (cost=0.00..55675.00 rows=297450 width=4)
                                                   Filter: (c_mktsegment = 'BUILDING'::bpchar)


When I ran this sql, I got error message like this:
ERROR:  Invalid Datanode number
CONTEXT:  parallel worker

I think the reason is that the parallel execution happened on coordinators, not on datanodes. I have a patch to fix this, and the patch is to make the parallel execution only happen on datanodes.
We can have further discussion about this, and to find if there are some more better sulotions about this.



regards

Senhu(senhu at tencent.com<mailto:senhu at tencent.com>)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.postgres-xl.org/private.cgi/postgres-xl-developers-postgres-xl.org/attachments/20170621/3feb036c/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gather.patch
Type: application/octet-stream
Size: 2410 bytes
Desc: gather.patch
URL: <http://lists.postgres-xl.org/private.cgi/postgres-xl-developers-postgres-xl.org/attachments/20170621/3feb036c/attachment-0001.obj>


More information about the Postgres-xl-developers mailing list