Re: Construction of Plan-node by CSP (RE: Custom/Foreign-Join-APIs)

From: Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Thom Brown <thom(at)linux(dot)com>, Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>, "Shigeru Hanada" <shigeru(dot)hanada(at)gmail(dot)com>, "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Construction of Plan-node by CSP (RE: Custom/Foreign-Join-APIs)
Date: 2015-06-04 10:28:19
Message-ID: 9A28C8860F777E439AA12E8AEA7694F8010F3EA6@BPXM15GP.gisp.nec.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Tom Lane
> Sent: Thursday, May 28, 2015 5:35 AM
> To: Robert Haas
> Cc: Kaigai Kouhei(海外 浩平); Thom Brown; Kohei KaiGai; Shigeru Hanada;
> pgsql-hackers(at)postgreSQL(dot)org
> Subject: Re: [HACKERS] Construction of Plan-node by CSP (RE:
> Custom/Foreign-Join-APIs)
>
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > Tom, do you want to review this patch and figure out how to solve the
> > underlying problem? If not, I will take care of it. But I will be
> > unhappy if I put time and effort into this and then you insist on
> > changing everything afterwards, again.
>
> [ sorry for slow response, been busy ] I will take a look.
>
Tom, how about your availability?

From my side, I adjust my extension (PG-Strom) to fit the infrastructure you proposed,
then confirmed it is workable even if custom-scan, that replaced relations join, takes
more than two Path nodes in the custom_children list of CustomPath, with no exportiong
create_plan_recurse().

Below is an example of custom-scan (GpuJoin) that involves four relations join.
Its code base is the latest master + custom-join-children.v2.patch; unchanged from
the last post.

postgres=# explain analyze select avg(x) from t0 natural join t1 natural join t2 natural join t3 group by cat;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------
HashAggregate (cost=298513.77..298514.10 rows=26 width=12) (actual time=5622.028..5622.033 rows=26 loops=1)
Group Key: t0.cat
-> Custom Scan (GpuJoin) (cost=4702.00..249169.85 rows=9868784 width=12) (actual time=540.718..2075.566 rows=10000000 loops=1)
Bulkload: On (density: 100.00%)
Depth 1: Logic: GpuHashJoin, HashKeys: (cid), JoinQual: (cid = cid), nrows_ratio: 0.98936439
Depth 2: Logic: GpuHashJoin, HashKeys: (bid), JoinQual: (bid = bid), nrows_ratio: 0.99748135
Depth 3: Logic: GpuHashJoin, HashKeys: (aid), JoinQual: (aid = aid), nrows_ratio: 1.00000000
-> Custom Scan (BulkScan) on t0 (cost=0.00..242858.60 rows=10000060 width=24) (actual time=8.555..903.864 rows=10000000 loops=1)
-> Seq Scan on t3 (cost=0.00..734.00 rows=40000 width=4) (actual time=0.019..4.370 rows=40000 loops=1)
-> Seq Scan on t2 (cost=0.00..734.00 rows=40000 width=4) (actual time=0.004..4.182 rows=40000 loops=1)
-> Seq Scan on t1 (cost=0.00..734.00 rows=40000 width=4) (actual time=0.005..4.275 rows=40000 loops=1)
Planning time: 0.918 ms
Execution time: 6178.264 ms
(13 rows)

Thanks,
--
NEC Business Creation Division / PG-Strom Project
KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>

Attachment Content-Type Size
custom-join-children.v2.patch application/octet-stream 9.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2015-06-04 10:55:53 Re: Missing "-i / --ignore-version" in pg_dump help
Previous Message Simon Riggs 2015-06-04 09:28:42 Re: [CORE] postpone next week's release