Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aggregate doesn't push down #16

Open
harris-chiu opened this issue Jun 4, 2019 · 16 comments
Open

aggregate doesn't push down #16

harris-chiu opened this issue Jun 4, 2019 · 16 comments

Comments

@harris-chiu
Copy link

I have run the test in sql/clickhousedb_fdw.sql

It appears that the aggregate doesn't push down as expected

EXPLAIN (VERBOSE, COSTS OFF) select count(*) from ft1;
QUERY PLAN

Aggregate
Output: count(*)
-> Foreign Scan on public.ft1
Remote SQL: SELECT NULL FROM regression.t1
(4 rows)

@harris-chiu
Copy link
Author

More info is that the foreign scan cost keeps having zero. Maybe this costs the aggregates doesn’t push down ?

@harris-chiu
Copy link
Author

More info:
I have tested the setup in the readme page and reverted some commit.
Supposingly, this statement should trigger predicate pushdown,
postgres=# EXPLAIN VERBOSE SELECT count(bbl) FROM tax_bills_nyc;
QUERY PLAN

Foreign Scan (cost=1.00..-1.00 rows=1000 width=8)
Output: (count(bbl))
Relations: Aggregate on (tax_bills_nyc)
Remote SQL: SELECT count(bbl) FROM test_database.tax_bills_nyc
(4 rows)

but after this commit
postgres=# EXPLAIN VERBOSE SELECT count(bbl) FROM tax_bills_nyc;
QUERY PLAN

Aggregate (cost=0.00..0.01 rows=1 width=8)
Output: count(bbl)
-> Foreign Scan on public.tax_bills_nyc (cost=0.00..0.00 rows=0 width=8)
Output: bbl, owner_name, address, tax_class, tax_rate, emv, tbea, bav, tba, property_tax, condonumber, condo, insertion_date
Remote SQL: SELECT bbl FROM test_database.tax_bills_nyc
(5 rows)

16d79c0

It looks like this commit is causing the issue

@ethanryl
Copy link

I have the same problem that my query cannot be pushed down.

@ethanryl
Copy link

EXPLAIN VERBOSE SELECT count(bbl) FROM tax_bills_nyc;
QUERY PLAN

Aggregate (cost=0.00..0.01 rows=1 width=8)
Output: count(bbl)
-> Foreign Scan on public.tax_bills_nyc (cost=0.00..0.00 rows=0 width=8)
Output: bbl, owner_name, address, tax_class, tax_rate, emv, tbea, bav, tba, property_tax, condonumber, condo, insertion_date
Remote SQL: SELECT bbl FROM test_database.tax_bills_nyc
(5 rows)

@ibrarahmad
Copy link
Contributor

ibrarahmad commented Jun 11, 2019 via email

@ethanryl
Copy link

EXPLAIN VERBOSE SELECT count(*) FROM tax_bills_nyc;
QUERY PLAN

Aggregate (cost=0.00..0.01 rows=1 width=8)
Output: count(*)
-> Foreign Scan on public.tax_bills_nyc (cost=0.00..0.00 rows=0 width=0)
Output: bbl, owner_name, address, tax_class, tax_rate, emv, tbea, bav, tba, property_tax, condonumber, condo, insertion_date
Remote SQL: SELECT NULL FROM test_database.tax_bills_nyc

@ibrarahmad
Copy link
Contributor

ibrarahmad commented Jun 11, 2019 via email

@ethanryl
Copy link

ethanryl commented Jun 11, 2019 via email

@ibrarahmad
Copy link
Contributor

ibrarahmad commented Jun 11, 2019 via email

@ethanryl
Copy link

ethanryl commented Jun 24, 2019 via email

@ibrarahmad
Copy link
Contributor

ibrarahmad commented Jun 25, 2019 via email

@harris-chiu
Copy link
Author

you can actually take out the commit I mentioned earlier to get the push down working
16d79c0

@ibrarahmad
Copy link
Contributor

ibrarahmad commented Jun 25, 2019 via email

@ethanryl
Copy link

hi,ibrarahmad、harris-chiu The problem has been solved. I set clickhousedb_fdw.join_pushdown_safe=on and then the SQL can be pushed down. Thank you very much.

@harris-chiu
Copy link
Author

harris-chiu commented Jun 26, 2019 via email

@ibrarahmad
Copy link
Contributor

ibrarahmad commented Jun 26, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants