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

How to generate Postgres stats for Clickhouse foreign tables? #108

Open
george24601 opened this issue Aug 16, 2024 · 0 comments
Open

How to generate Postgres stats for Clickhouse foreign tables? #108

george24601 opened this issue Aug 16, 2024 · 0 comments

Comments

@george24601
Copy link

Hi,

My query joins Postgres tables with one Clickhouse foreign table, and the query plan is not efficient. For example, when my join selects an empty date range on the CH table, e.g. (event_date > 2025-01-01 and event_date < 2024-01-01), Postgres still foreign scans CH thousands of times.

I think the bad query plan is partially caused by the lack of stats, i.e., pg_stats is empty for that Clickhouse foreign table, but no stats is generated after I run ANALYZE on that Clickhouse foreign table.

My questions

  • Did anyone experience a similar problem? How did you solve it?
  • Should the Clickhouse FDW support the fetch_size and use_remote_estimate options, similar to the options in postgres_fdw?

Thanks,

George

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

1 participant