-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: support prepare pushdown #140
base: dev
Are you sure you want to change the base?
Conversation
0030c41
to
9cc49c9
Compare
Note: There is a issue that PostgreSQL will replan the query when certain catalog changes occur, such as changes to the search path or when a table is deleted. In contrast, DuckDB does not replan when the search path is changed.
|
Can we force DuckDB to replan via some API call? We want to imitate the Postgres behaviour as much as possible. |
Yes. We could execute |
Sweet. That sounds wonderful. We want to be as "Postgres idiomatic as possible", so whatever the user experience Postgres users expect is is what we should try to replicate. |
f08ae75
to
df5d685
Compare
Yes, I completely agree. I detect changes in the search path and determine whether to replan in DuckDB. It's ready for review. @rebasedming |
comment: add test comment
c6c5b68
to
6b96f8c
Compare
} | ||
|
||
if unsafe { !(*stmt).options.is_null() } { | ||
error!("the EXPLAIN options provided are not supported for DuckDB pushdown queries."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I correct in understanding that this is fixed in your other PR? Or are there other options that won't be supported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've just moved the code. I will implement options support in another PR.
return Ok(true); | ||
} | ||
|
||
// we need to make Duckdb replan the `PREPARE` statement when search path changed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to match Postgres' default behaviour
#[cfg(feature = "pg13")] | ||
let cached_plan = pg_sys::GetCachedPlan(plan_source, null_mut(), false, null_mut()); | ||
|
||
#[cfg(not(feature = "pg13"))] | ||
let cached_plan = pg_sys::GetCachedPlan(plan_source, null_mut(), null_mut(), null_mut()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to call GetCachedPlan twice here? Could you please add a comment to explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks good to me! @Weijun-H could you please review this? If this works with you, I'm happy to get it in
I will carefully review this PR today or tomorrow. |
Ticket(s) Closed
What
Why
How
Pushdown
PREPARE
,EXECUTE
andDEALLOCATE
statement to duckdb directly.Tests