summaryrefslogtreecommitdiff
path: root/sql/sql_explain.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.5 into 10.6Marko Mäkelä2021-10-281-1/+1
|\
| * Merge 10.4 into 10.5Marko Mäkelä2021-10-281-1/+1
| |\
| | * Merge 10.3 into 10.4Marko Mäkelä2021-10-281-1/+1
| | |\
| | | * Merge 10.2 into 10.3Marko Mäkelä2021-10-281-1/+1
| | | |\
| | | | * Fix comment10.2-tmpSergei Petrunia2021-10-221-1/+1
| | | | |
* | | | | Reduce usage of strlen()Monty2021-05-191-63/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes: - To detect automatic strlen() I removed the methods in String that uses 'const char *' without a length: - String::append(const char*) - Binary_string(const char *str) - String(const char *str, CHARSET_INFO *cs) - append_for_single_quote(const char *) All usage of append(const char*) is changed to either use String::append(char), String::append(const char*, size_t length) or String::append(LEX_CSTRING) - Added STRING_WITH_LEN() around constant string arguments to String::append() - Added overflow argument to escape_string_for_mysql() and escape_quotes_for_mysql() instead of returning (size_t) -1 on overflow. This was needed as most usage of the above functions never tested the result for -1 and would have given wrong results or crashes in case of overflows. - Added Item_func_or_sum::func_name_cstring(), which returns LEX_CSTRING. Changed all Item_func::func_name()'s to func_name_cstring()'s. The old Item_func_or_sum::func_name() is now an inline function that returns func_name_cstring().str. - Changed Item::mode_name() and Item::func_name_ext() to return LEX_CSTRING. - Changed for some functions the name argument from const char * to to const LEX_CSTRING &: - Item::Item_func_fix_attributes() - Item::check_type_...() - Type_std_attributes::agg_item_collations() - Type_std_attributes::agg_item_set_converter() - Type_std_attributes::agg_arg_charsets...() - Type_handler_hybrid_field_type::aggregate_for_result() - Type_handler_geometry::check_type_geom_or_binary() - Type_handler::Item_func_or_sum_illegal_param() - Predicant_to_list_comparator::add_value_skip_null() - Predicant_to_list_comparator::add_value() - cmp_item_row::prepare_comparators() - cmp_item_row::aggregate_row_elements_for_comparison() - Cursor_ref::print_func() - Removes String_space() as it was only used in one cases and that could be simplified to not use String_space(), thanks to the fixed my_vsnprintf(). - Added some const LEX_CSTRING's for common strings: - NULL_clex_str, DATA_clex_str, INDEX_clex_str. - Changed primary_key_name to a LEX_CSTRING - Renamed String::set_quick() to String::set_buffer_if_not_allocated() to clarify what the function really does. - Rename of protocol function: bool store(const char *from, CHARSET_INFO *cs) to bool store_string_or_null(const char *from, CHARSET_INFO *cs). This was done to both clarify the difference between this 'store' function and also to make it easier to find unoptimal usage of store() calls. - Added Protocol::store(const LEX_CSTRING*, CHARSET_INFO*) - Changed some 'const char*' arrays to instead be of type LEX_CSTRING. - class Item_func_units now used LEX_CSTRING for name. Other things: - Fixed a bug in mysql.cc:construct_prompt() where a wrong escape character in the prompt would cause some part of the prompt to be duplicated. - Fixed a lot of instances where the length of the argument to append is known or easily obtain but was not used. - Removed some not needed 'virtual' definition for functions that was inherited from the parent. I added override to these. - Fixed Ordered_key::print() to preallocate needed buffer. Old code could case memory overruns. - Simplified some loops when adding char * to a String with delimiters.
* | | | | MDEV-17399 Add support for JSON_TABLE.Alexey Botchkov2021-04-211-0/+6
|/ / / / | | | | | | | | | | | | | | | | The specific table handler for the table functions was introduced, and used to implement JSON_TABLE.
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-05-131-0/+5
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-05-131-0/+5
| |\ \ \ | | |/ /
| | * | MDEV-17568: LATERAL DERIVED is not clearly visible in EXPLAIN FORMAT=JSONSergei Petrunia2020-05-061-0/+5
| | | | | | | | | | | | | | | | Make LATERAL DERIVED tables visible in EXPLAIN FORMAT=JSON output.
* | | | MDEV-20854: ANALYZE for statements: not clear where the time is spentSergei Petrunia2019-11-121-2/+3
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Count the "gap" time between table accesses and display it as r_other_time_ms in the "table" element. * The advantage of this approach is that it doesn't add any new my_timer_cycles() calls. * The disadvantage is that the definition of what is done during "other time" is not that clear: it includes checking the WHERE (for this table), constructing index lookup tuple (for the next table) writing to GROUP BY temporary table (as we dont account for that time separately [yet], etc)
* | | Merge 10.3 into 10.4, except for MDEV-20265Marko Mäkelä2019-08-231-0/+2
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | The MDEV-20265 commit e746f451d57def4be679caafc29976741b3e89f7 introduces DBUG_ASSERT(right_op == r_tbl) in st_select_lex::add_cross_joined_table(), and that assertion would fail in several tests that exercise joins. That commit was skipped in this merge, and a separate fix of MDEV-20265 will be necessary in 10.4.
| * | MDEV-19740 Debug build of 10.3.15 FTBFSAleksey Midenkov2019-08-211-1/+2
| | | | | | | | | | | | | | | | | | Fix debug build failing with error: extended initializer lists only available with -std=c++11 or -std=gnu++11
| * | MDEV-19740 Debug build of 10.3.15 FTBFSAleksey Midenkov2019-08-191-0/+1
| | | | | | | | | | | | | | | | | | * Replace LINT_INIT for non-struct types with ctor initializers; * Check BUILD_DEPS list is not empty so REMOVE_DUPLICATES won't throw error.
* | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-06-141-3/+3
|\ \ \ | |/ /
| * | Merge branch '10.2' into 10.3Oleksandr Byelkin2019-06-141-4/+4
| |\ \ | | |/
| | * Merge branch '10.1' into 10.2Oleksandr Byelkin2019-06-131-4/+4
| | |\
| | | * Merge branch '5.5' into 10.1Oleksandr Byelkin2019-06-121-4/+4
| | | |
* | | | Merge 10.3 into 10.4Marko Mäkelä2019-06-121-0/+5
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2019-06-111-0/+5
| |\ \ \ | | |/ /
| | * | MDEV-19714: JOIN::pseudo_bits_cond is not visible in EXPLAIN FORMAT=JSONbb-10.2-mdev19714Sergei Petrunia2019-06-081-0/+5
| | | | | | | | | | | | | | | | Make it visible
* | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-1/+1
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
| |\ \ \ | | |/ /
| | * | Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| | |\ \ | | | |/
| | | * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | | |
| | | * Fix gcc 7.3 compiler warnings.Oleksandr Byelkin2018-08-031-1/+1
| | | |
* | | | Merge branch '10.4' into bb-10.4-mdev16188Igor Babaev2019-02-141-4/+24
|\ \ \ \
| * \ \ \ Merge branch '10.4' into bb-10.4-mdev17096Igor Babaev2019-02-121-1/+1
| |\ \ \ \
| | * | | | MDEV-6111 Optimizer TraceVarun Gupta2019-02-131-1/+1
| | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This task involves the implementation for the optimizer trace. This feature produces a trace for any SELECT/UPDATE/DELETE/, which contains information about decisions taken by the optimizer during the optimization phase (choice of table access method, various costs, transformations, etc). This feature would help to tell why some decisions were taken by the optimizer and why some were rejected. Trace is session-local, controlled by the @@optimizer_trace variable. To enable optimizer trace we need to write: set @@optimizer_trace variable= 'enabled=on'; To display the trace one can run: SELECT trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; This task also involves: MDEV-18489: Limit the memory used by the optimizer trace introduces a switch optimizer_trace_max_mem_size which limits the memory used by the optimizer trace. This was implemented by Sergei Petrunia.
| * | | | MDEV-17096 Pushdown of simple derived tables to storage enginesIgor Babaev2019-02-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resolved the problem of forming a proper query string for FEDERATEDX. Added test cases. Cleanup of extra spaces.
| * | | | MDEV-17096 Pushdown of simple derived tables to storage enginesIgor Babaev2019-02-061-4/+24
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-17631 select_handler for a full query pushdown Interfaces + Proof of Concept for federatedx with test cases. The interfaces have been developed for integration of ColumnStore engine.
* | | | MDEV-16188 Post merge fixes: trying to get rid of Windows warnings.Igor Babaev2019-02-091-1/+1
| | | |
* | | | MDEV-16188 Post merge fixes: more for TokuDBIgor Babaev2019-02-081-1/+2
| | | |
* | | | MDEV-18144 ANALYZE fixesGalina Shalygina2019-02-071-3/+18
| | | | | | | | | | | | | | | | Fix bugs caused by changes for ANALYZE
* | | | MDEV-16188 Post merge fixes:fixed warnings on WindowsIgor Babaev2019-02-061-1/+2
| | | | | | | | | | | | | | | | Also adjusted some result files after Galina's last patch for ANALYZE.
* | | | MDEV-18144: ANALYZE for statement support for PK filtersGalina Shalygina2019-02-061-5/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ANALYZE and ANALYZE FORMAT=JSON structures are changed in the way that they show additional information when rowid filter is used: - r_selectivity_pct - the observed filter selectivity - r_buffer_size - the size of the rowid filter container buffer - r_filling_time_ms - how long it took to fill rowid filter container New class Rowid_filter_tracker was added. This class is needed to collect data about how rowid filter is executed.
* | | | MDEV-16188 Use in-memory PK filters built from range index scansIgor Babaev2019-02-031-17/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains a full implementation of the optimization that allows to use in-memory rowid / primary filters built for range   conditions over indexes. In many cases usage of such filters reduce   the number of disk seeks spent for fetching table rows. In this implementation the choice of what possible filter to be applied   (if any) is made purely on cost-based considerations. This implementation re-achitectured the partial implementation of the feature pushed by Galina Shalygina in the commit 8d5a11122c32f4d9eb87536886c6e893377bdd07. Besides this patch contains a better implementation of the generic   handler function handler::multi_range_read_info_const() that takes into account gaps between ranges when calculating the cost of range index scans. It also contains some corrections of the implementation of the handler function records_in_range() for MyISAM. This patch supports the feature for InnoDB and MyISAM.
* | | | MDEV-16188: Use in-memory PK filters built from range index scansGalina Shalygina2018-09-281-3/+29
|/ / / | | | | | | | | | First phase: make optimizer choose to use filter and show it in EXPLAIN.
* | | Merge branch '10.2' into 10.3Sergei Golubchik2018-06-301-2/+1
|\ \ \ | |/ /
| * | Merge branch '10.1' into 10.2Sergei Golubchik2018-06-211-2/+1
| |\ \ | | |/
| | * MDEV-16191: Analyze format=json gives incorrect value for r_limit inside a ↵Varun Gupta2018-06-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dependent subquery when ORDER BY is present Currently for setting r_limit we divide with the number of iterations we invoke the dependent subquery. This is not needed for the case of limit. For varying limits we produce the output that the limit varies with execution. Also there is a type for filtered , we forgot to multiply by 100 as it is represented as a percent.
* | | MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from ↵Vladislav Vaintroub2018-02-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'size_t' to 'type', possible loss of data) Handle string length as size_t, consistently (almost always:)) Change function prototypes to accept size_t, where in the past ulong or uint were used. change local/member variables to size_t when appropriate. This fix excludes rocksdb, spider,spider, sphinx and connect for now.
* | | Merge bb-10.2-ext into 10.3Marko Mäkelä2018-01-041-1/+7
|\ \ \
| * \ \ Merge remote-tracking branch 'origin/10.2' into bb-10.2-extMonty2018-01-011-1/+7
| |\ \ \ | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: cmake/make_dist.cmake.in mysql-test/r/func_json.result mysql-test/r/ps.result mysql-test/t/func_json.test mysql-test/t/ps.test sql/item_cmpfunc.h
| | * | MDEV-10844: EXPLAIN FORMAT=JSON doesn't show order direction for filesortVarun Gupta2017-12-301-1/+7
| | | | | | | | | | | | | | | | | | | | Currently explain format=json does not show the order direction of fields used during filesort. This patch would remove this limitation
* | | | Changed "const row not found" to "Const row not found"Monty2017-12-021-3/+3
| | | | | | | | | | | | | | | | | | | | Also changed Unique row not found to use uppercase first. This was done to make these messages consistent with the rest
* | | | Handle failures from mallocMichael Widenius2017-11-171-10/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most "new" failures fixed in the following files: - sql_select.cc - item.cc - item_func.cc - opt_subselect.cc Other things: - Allocate udf_handler strings in mem_root - Required changes in sql_string.h - Add mem_root as argument to some new [] calls - Mark udf_handler strings as thread specific - Removed some comment blocks with code
* | | | Changed KEY names to use LEX_CSTRINGMichael Widenius2017-08-241-2/+3
| | | |
* | | | Enusure that my_global.h is included firstMichael Widenius2017-08-241-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added sql/mariadb.h file that should be included first by files in sql directory, if sql_plugin.h is not used (sql_plugin.h adds SHOW variables that must be done before my_global.h is included) - Removed a lot of include my_global.h from include files - Removed include's of some files that my_global.h automatically includes - Removed duplicated include's of my_sys.h - Replaced include my_config.h with my_global.h
* | | Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2017-07-071-2/+5
|\ \ \ | |/ /