-
Notifications
You must be signed in to change notification settings - Fork 123
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
[CBRD-24537] Improve the performance of MERGE query by using NOT EXISTS sub-query #3919
Conversation
if (expr) | ||
{ | ||
if (expr->info.expr.arg1) | ||
{ | ||
parser_free_tree (parser, expr->info.expr.arg1); | ||
corr_subq = NULL; | ||
} | ||
parser_free_tree (parser, expr); | ||
} | ||
|
||
if (corr_subq) | ||
{ | ||
parser_free_tree (parser, corr_subq); | ||
} |
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.
How about below?
if (expr) | |
{ | |
if (expr->info.expr.arg1) | |
{ | |
parser_free_tree (parser, expr->info.expr.arg1); | |
corr_subq = NULL; | |
} | |
parser_free_tree (parser, expr); | |
} | |
if (corr_subq) | |
{ | |
parser_free_tree (parser, corr_subq); | |
} | |
if (corr_subq) | |
{ | |
parser_free_tree (parser, corr_subq); | |
} | |
if (expr) | |
{ | |
parser_free_tree (parser, expr); | |
} |
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 code sequence is right because the expr could be assigend to corr_subq.
@@ -25111,7 +25111,7 @@ pt_to_merge_update_query (PARSER_CONTEXT * parser, PT_NODE * select_list, PT_MER | |||
PT_NODE * | |||
pt_to_merge_insert_query (PARSER_CONTEXT * parser, PT_NODE * select_list, PT_MERGE_INFO * info) | |||
{ | |||
PT_NODE *subq, *corr_subq, *expr, *and_expr, *value; | |||
PT_NODE *subq, *corr_subq = NULL, *expr = NULL, *and_expr = NULL, *value = NULL; |
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.
It is trivial.
PT_NODE *subq, *corr_subq = NULL, *expr = NULL, *and_expr = NULL, *value = NULL; | |
PT_NODE *subq = NULL, *corr_subq = NULL, *expr = NULL, *and_expr = NULL, *value = NULL; |
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.
subq is always assigned some address as new node.
http://jira.cubrid.org/browse/CBRD-24537
The MERGE query's "NOT MATCHED" part is rewritten by using COUNT query for checking "NOT MATCHED", however, the performance of COUNT query is not good compared with NOT EXISTS query.
We will enhance the performance of the MERGE query by using "NOT EXISTS" sub-query instead of COUNT query.