-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Optimizer hints #3474
Open
Olernov
wants to merge
7
commits into
11.6
Choose a base branch
from
bb-11.6-hints-v2
base: 11.6
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Optimizer hints #3474
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Lex_ident_cli* into a new file sql/lex_ident_cli.h - Lex_ident_sys* into a new file sql/lex_ident_sys.h - Well_formed_prefix into include/m_ctype.h This change is needed to the optimizer hint parser coming soon.
Implementing a recursive descent parser for optimizer hints.
This commit introduces: - the infrastructure for optimizer hints; - hints for join buffering: BNL(), NO_BNL(), BKA(), NO_BKA(); - NO_ICP() hint for disabling index condition pushdown; - MRR(), MO_MRR() hint for multi-range reads control; - NO_RANGE_OPTIMIZATION() for disabling range optimization; - QB_NAME() for assigning names for query blocks.
- Using Lex_ident_sys to scan identifiers, like the SQL parser does. This fixes handling of double-quote-delimited and backtick-delimited identifiers, as well as handling of non-ASCII identifiers. Unescaping and converting from the client character set to the system character set is now done using Lex_ident_cli_st and Lex_ident_sys, like it's done in the SQL tokenizer/parser. Adding helper methods to_ident_cli() and to_ident_sys() in Optimizer_hint_parser::Token. - Fixing the hint parser to report a syntax error when an empty identifiers: SELECT /*+ BKA(``) */ * FROM t1; - Moving a part of the code from opt_hints_parser.h to opt_hints_parser.cc Moving these method definitions: - Optimizer_hint_tokenizer::find_keyword() - Optimizer_hint_tokenizer::get_token() to avoid huge pieces of the code in the header file. - A Lex_ident_cli_st cleanup Fixing a few Lex_ident_cli_st methods to return Lex_ident_cli_st & instead of void, to use them easier in the caller code. - Fixing the hint parser to display the correct line number Adding a new data type Lex_comment_st (a combination of LEX_CSTRING and a line number) Using it in sql_yacc.yy - Getting rid of redundant dependencies on sql_hints_parser.h Moving void LEX::resolve_optimizer_hints() from sql_lex.h to sql_lex.cc Adding a class Optimizer_hint_parser_output, deriving from Optimizer_hint_parser::Hint_list. Fixing the hint parser to return a pointer to an allocated instance of Optimizer_hint_parser_output rather than an instance of Optimizer_hint_parser::Hint_list. This allows to use a forward declaration of Optimizer_hint_parser_output in sql_lex.h and thus avoid dependencies on sql_hints_parser.h.
|
Olernov
force-pushed
the
bb-11.6-hints-v2
branch
from
August 21, 2024 11:05
e54f776
to
dd8934b
Compare
Olernov
force-pushed
the
bb-11.6-hints-v2
branch
2 times, most recently
from
September 2, 2024 09:57
6edc022
to
4311116
Compare
Forbid adding optimizer hints to view definitions. In the case when optimizer hints are added to the view definition at a `CREATE (OR REPLACE) VIEW`/`ALTER VIEW` statement, a warning is generated and the hints are ignored. This commit also disables ps-protocol for test cases where `Unresolved table/index name` warnings are generated. The reason for this is such warnings are generated during both PREPARE and EXECUTE stages. Since opt_hints.test has `--enable_prepare_warnings`, running it with `--ps-protocol` causes duplication of warning messages
Olernov
force-pushed
the
bb-11.6-hints-v2
branch
from
September 3, 2024 05:17
4311116
to
7fd7b6a
Compare
join_cache_level=0 disables join cache buffers, but the hint BNL() now allows to employ BNL(H) buffers for particular tables or query blocks. This commit also adds a number of test cases including OUTER JOINs to make sure hints do not break the rules of join buffers application
Olernov
force-pushed
the
bb-11.6-hints-v2
branch
from
September 6, 2024 06:32
7fd7b6a
to
c8ce9fb
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Provide the possibility to add optimizer hints to statements in MySQL-compatible format:
Implemented so far:
Release Notes
TODO: What should the release notes say about this change?
Include any changed system variables, status variables or behaviour. Optionally list any https://mariadb.com/kb/ pages that need changing.
How can this PR be tested?
TODO: modify the automated test suite to verify that the PR causes MariaDB to behave as intended.
Consult the documentation on "Writing good test cases".
If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.
Basing the PR against the correct MariaDB version
PR quality check