How and at what stage to stop FDW to generate plan with JOIN.
Ibrar Ahmed <ibrar.ahmad@gmail.com>
From: Ibrar Ahmed <ibrar.ahmad@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Cc: fujita.etsuro@lab.ntt.co.jp
Date: 2019-04-23T19:22:25Z
Lists: pgsql-hackers
Hi,
I am working on an FDW where the database does not support any operator
other than "=" in JOIN condition. Some queries are genrating the plan with
JOIN having "<" operator. How and at what stage I can stop FDW to not make
such a plan. Here is my sample query.
tpch=# 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-22'
and l_shipdate > date '1995-03-22'
group by
l_orderkey,
o_orderdate,
o_shippriority
order by
revenue,
o_orderdate
LIMIT 10;
QUERY PLAN
...
Merge Cond: (orders.o_orderkey = lineitem.l_orderkey)
-> Foreign Scan (cost=1.00..-1.00 rows=1000 width=50)
Output: orders.o_orderdate, orders.o_shippriority, orders.o_orderkey
Relations: (customer) INNER JOIN (orders)
Remote SQL: SELECT r2.o_orderdate, r2.o_shippriority, r2.o_orderkey
FROM db.customer
r1 ALL INNER JOIN db.orders r2 ON (((r1.c_custkey = r2.o_custkey)) AND
((r2.o_orderdate < '1995-03-22')) AND ((r1.c_mktsegment = 'BUILDING')))
ORDER BY r2.o_orderkey, r2.o_orderdate, r2.o_shippriority
...
--
Ibrar Ahmed
Commits
-
Fix some minor postmaster-state-machine issues.
- f0c82454dcb4 9.4.22 landed
- ec537c1e8c8b 9.6.13 landed
- c7e38be4df4c 9.5.17 landed
- f8642fb17892 11.3 landed
- a0bbd012d9fe 10.8 landed
- 0fae84623214 12.0 landed