clickhouse_fdw icon indicating copy to clipboard operation
clickhouse_fdw copied to clipboard

GROUP BY in joined subqueries

Open VernonVega opened this issue 6 years ago • 1 comments

FDW seems to not pushdown JOIN of subqueries if they contain GROUP BY inside.

SELECT * FROM 
(
SELECT sale_id FROM sales
) a
JOIN
(
SELECT sale_id, product_id FROM products
) b ON a.sale_id = b.sale_id

Lets say both tables (sales and products) are foreign tables. Previous query seems to work well but next query seems to not pushdown join.

SELECT * FROM 
(
SELECT sale_id FROM sales
GROUP BY  sale_id
) a
JOIN
(
SELECT sale_id, product_id FROM products
) b ON a.sale_id = b.sale_id

Is there any way to change this behaviour?

VernonVega avatar Sep 05 '19 10:09 VernonVega

For now clickhouse_fdw mostly does same thing as postgres_fdw. And additional features like these will require a lot more thinking and analysing, for what I do not have enough time right now. It's easy to implement exact feature, but hard to predict that it would not broke other things in planner.

ildus avatar Sep 12 '19 14:09 ildus