-
Notifications
You must be signed in to change notification settings - Fork 246
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
Add support for DELETE query planning #538
base: main
Are you sure you want to change the base?
Conversation
a55b0d4
to
a42b185
Compare
3d2ac33
to
57c7a56
Compare
f46fcee
to
e83819e
Compare
core/translate/planner.rs
Outdated
group_by: None, | ||
order_by: None, | ||
aggregates: vec![], | ||
limit: None, // TODO: add support for limit |
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 should be fairly simple to add, search for DecrJumpZero
in emitter.rs
and put one of those in emit_delete_insns()
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.
I want to maintain this PR small for now. And I want to improve my understanding on limit(+ order by).
What do you think of I add a follow up PR right after?
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.
Changed my mind. Added limit support 🤖
Purpose of this PR
Support for DELETE query execution planning
Implementation Details
The main entry point for planning DELETE queries is the
translate_delete
function. It is composed of three primary steps:prepare_delete_plan
:optimize_delete_plan
:emit_program_for_delete
:I've tried to reuse existing logic(mostly on SELECT operations) as much as I can, so that we can automatically incorporate new changes automatically.
Delete planning debug
I've used
println!(...)
to specify the rows to delete. Example belowBytecode compatibility
EXPLAIN DELETE FROM users WHERE id = 1;
EXPLAIN DELETE FROM users WHERE id > 3
EXPLAIN DELETE FROM users WHERE id < 3
TODO(future works)
Clear
opcodedelete
is implemented inCursor