-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
MDEV-36106 New-style hints: [NO_]DERIVED_CONDITION_PUSHDOWN, [NO_]MERGE #3870
base: bb-11.8-MDEV-35504-opt-hints-v2
Are you sure you want to change the base?
MDEV-36106 New-style hints: [NO_]DERIVED_CONDITION_PUSHDOWN, [NO_]MERGE #3870
Conversation
7b199cb
to
12c9440
Compare
mysql-test/main/mdev-36106-derived-condition-pushdown-hint.test
Outdated
Show resolved
Hide resolved
mysql-test/main/mdev-36106-derived-condition-pushdown-hint.test
Outdated
Show resolved
Hide resolved
Note: this adds
code in TABLE_LIST::init_derived() which is called from open_and_lock_tables/mysql_handle_derived. I guess the need to make a decision whether to do merging in open_and_lock_tables() is a given (we can't change it within the scope of this project). But at least the docs in opt_hints.h need to be updated. |
Without the hint, the above query would merge the derived table. It didn't, so the hint had an effect. But EXPLAIN text or optimizer trace do not have anything about the hint:
|
@spetrunia If I’m understanding the code correctly, it is working as expected. We use a bitmap to remember which hints are specified. But this bitmap conflates “is specified as false” with “not specified”. So in the |
Trying on MySQL (I am using 8.4 but I suppose earlier versions would work the same):
Note the NO_MERGE in the warning... |
@spetrunia and @Olernov, I fixed the issue with the hint name not appearing in the warnings. I'll update the PR as soon as I finish adding the new tests. |
a1e3615
to
9bef428
Compare
Implements and tests the optimizer hints DERIVED_CONDITION_PUSHDOWN and NO_DERIVED_CONDITION_PUSHDOWN, table-level hints to enable and disable, respectively, the condition pushdown for derived tables which is typically controlled by the condition_pushdown_for_derived optimizer switch. Implements and tests the optimizer hints MERGE and NO_MERGE, table-level hints to enable and disable, respectively, the derived_merge optimization which is typically controlled by the derived_merge optimizer switch. Sometimes hints need to be fixed before TABLE instances are available, but after TABLE_LIST instances have been created (as in the cases of MERGE and NO_MERGE). This commit introduces code to fix such hints provisionally, allowing them to be fully fixed later, after their corresponding TABLE instances have been created.
9bef428
to
4179821
Compare
This PR is in a logical place until I pick it back up in the next development sprint. I have more test cases to add, specifically for query block hints. |
Implements and tests the following optimizer hints:
Each of these are table-level hints. The first pair enable and disable, respectively, the condition pushdown for derived tables which is typically controlled by the condition_pushdown_for_derived optimizer switch. The second pair enable and disable, respectively, the derived table merge optimization which is typically controlled by the derived_merge optimizer switch.